Question: JAVA PROJECT 4.DOCX Project IV [After Chapter 6] 1) Add a date last modified note to include the date you made changes: 2) Add lines

JAVA PROJECT 4.DOCX Project IV [After Chapter 6]

1) Add a date last modified note to include the date you made changes:

2) Add lines the menu as follows Enter 4 to find the volume and area of a box. Enter 5 to find the volume and area of a sphere.

3) Change the validation check to allow 4 and 5 to be valid.

4) Define double variables length, width, height for use in the calculations for a box.

5) Define double boxVolume and boxArea for use in the calculations for a box.

6) Define double variables radius, sphereVolume, and sphereArea for use in the calculations for a sphere.

7) Enter code to test for choice = 4 and execute code similar to choices 1 and 2 for C to F and inches to centimeters that does this:

a) Ask for a length for a box

b) Ask for a height for a box

c) Ask for a width for a box

d) boxVolume = box ( 1, length, width, height); 1 calculate volume of box using the length, width, height of the box.

e) Call the same method box with these parameters boxArea = box(2, length, width, height), The 2 that the total area of the box is to be calculated.

f) Display to the user a message similar to this A box + length + by + width by height + has a volume of + boxVolume);

g) Display to the user a message similar to this A box +length + by + width + by +height + has an area of + boxArea);

8) Enter code to test for choice = 5 and execute code similar to choices 1, 2 and 3 for F to C and inches to centimeters and degrees to radians that does this:

a) Ask for the radius of the sphere.

b) sphereVolume = sphere (1, radius); 1 indicates that a volume is to be calculated.

c) sphereArea = sphere (2, radius); 2 indicates that area is to be calculated.

d) Display to the user a message similar to this A sphere of radius = + radius + has a volume = + sphereVolume);

e) Display to the user a message similar to this A sphere of radius = + radius + has an area = + sphereArea );

9) Create the method double box (int what, double len, double wid, double ht)

a) Define double result;

b) If what == 1) { result = len * width * ht; //calculate box volume }

c) If (what == 2) { result = 2*len*wid + 2*len*ht + 2*wid*ht; }

d) Return result

e) End method.

10) Create a method double sphere ( int what, double radius)

a) Define double result;

b) If what == 1) { result = 4.0/3.0 * 3.14159 * Math.pow(radius,3) ; // calculate the volume of the sphere. }

c) If (what ==2) { result = 4* 3.14159 *Math.pow( radius,2); // Calculate the area of the sphere }

d) Return result

e) End method.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!