Once again, OOP is determined to keep me up all night
Here are my methods
/**************************************************************** * Pyramid.java * Jenn Stanek * * This program models the calculations for the height, * volume and surface aresa of a tetrahedron simulation program. ***************************************************************/ import java.util.Scanner; public class Pyramid { Scanner stdIn = new Scanner(System.in); private double edge; // pyramid's common edge value //***************************************************************** // prompts user for edge value and assigns it to the edge instance variable public void initialize() { System.out.println("Enter a value for the pyramid's edges: "); edge = stdIn.nextDouble(); System.out.printf("Edge length = %d.3/n", edge); } //***************************************************************** public void setEdge() { this.edge = edge; } // end setEdge //***************************************************************** public void printPyramidData() // calculates and prints pyramid data { double height = ((Math.sqrt(2/3))*edge); System.out.printf ("Height = %d.3", height); double volume =((Math.sqrt(2))/12)*(Math.pow(edge,3)); System.out.printf ("Volume = %d.3", volume); double surfaceArea =(Math.sqrt(3))*(Math.pow(edge,2)); System.out.printf ("Surface Area = %d.3", surfaceArea); } //****************************************************************** } // end class Pyramid
They have to work with this driver
/*************************************** * PyramidDriver.java * John Dean * * This is the driver for the Pyramid class. ***************************************/ public class PyramidDriver { public static void main(String[] args) { Pyramid pyramid; pyramid = new Pyramid(); pyramid.initialize(); pyramid.printPyramidData(); pyramid.setEdge(4); pyramid.printPyramidData(); } // end main } // end class PyramidDriver
And I get this error
C:\Users\Jennifer\Documents\school\PyramidDriver.java:17: error: method setEdge in class Pyramid cannot be applied to given types; pyramid.setEdge(4); ^ required: no arguments found: int reason: actual and formal argument lists differ in length 1 error Tool completed with exit code 1
I'm not sure why it won't go back to the setEdge Method. I haven't seen this type of error before and I can't find it in my book. Any help to point me in the right direction would be appreciated.