Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need this C++ Program, it's not a java program JAVA PROJECT 4.DOCX Project IV [After Chapter 6] Add a date last modified note to

I need this C++ Program, it's not a java program

JAVA PROJECT 4.DOCX

Project IV [After Chapter 6]

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

Add lines the menu as follows

Enter 5 to find the volume and area of a box.

Enter 6 to find the volume and area of a sphere.

Change the validation check to allow 5 and 6 to be valid.

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

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

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

Enter code to test for choice = 5 and execute code similar to choices 1 and 2 for C to F and cm to inches that does this:

Ask for a length for a box

Ask for a height for a box

Ask for a width for a box

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

Call the same function box with these parameters boxArea = box(2, length, width, height),

The 2 that the total area of the box is to be calculated.

Display to the user a message similar to this A box + length + by + width

by height + has a volume of + boxVolume);

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

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

Ask for the radius of the sphere.

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

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

Display to the user a message similar to this A sphere of radius = + radius

+ has a volume = + sphereVolume);

Display to the user a message similar to this A sphere of radius = + radius

+ has an area = + sphereArea );

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

Define double result;

If what == 1)

If (what == 2)

Return result

End function.

Create a function double sphere ( int what, double radius)

Define double result;

If what == 1)

result = 4.0/3.0 * 3.14159 * Math.pow(radius,3) ; // calculate the volume of the sphere.

If (what ==2)

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

Return result

End function.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started