Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(C++) A local scientific lab stores hazardous chemicals for local manufacturing companies until they can be properly disposed of. The lab would like for you

(C++) A local scientific lab stores hazardous chemicals for local manufacturing companies until they can be properly disposed of. The lab would like for you to write a C++ program to calculate the storage charges based on the volume of the shape required for the particular material being stored.

a)The user will enter the name of the company requesting the storage, the desired shape for the chemical being stored via a menu option, and the dimensions of the shape.

Build an appropriate menu for the user that displays the three choices of shapes available with an option to also quit the program. Prompt the user for the desired menu choice. If the menu choice is invalid, display an error message.

Read the dimensions of the desired shape from the user.

b)Calculate the volume of the desired shape, the handling charge, and the storage charge based on the volume. Also calculate the total charges.

c)Display the name of the company requesting the service, the name of the chosen storage shape, the dimension of the shape, the calculated volume to a tenth of a decimal point, the handling charge, the storage charge, and the total charges based on the following criteria table. (Use symbolic constants where appropriate. Use 3.1416 to represent the value of PI.)

The formulas for the volumes are:

Volume of a cylinder = pi * r2 * h

Volume of a sphere = 4/3 * pi * r3

Volume of a cone = 1/3 * pi * r2 * h

The Storage and Handling charges are based on the following criteria:

Volume (x cubic inches)

Handling Charge

Storage Charge based on Volume

0 < x <= 150

$2.35

$0.15 per cubic inch

150 < x <= 250

$5.75

$0.25 for each cubic inch > 150

250 < x <= 350

$10.50

$0.35 for each cubic inch > 250

x > 350

$15.25

$0.45 for each cubic inch > 350

Sample Input #1:

Enter the company name: Ward Bus Company

Please enter your choice of shape from the following menu:

1. Cylinder

2. Sphere

3. Cone

4. Quit

Enter Menu Choice:? 3

Enter the radius of the cone: ? 5.3

Enter the height of the cone: ? 9.4

Sample Output:

Storage Bill for Ward Bus Company

Dimensions of the cone:

Radius: 5.3 inches

Height: 9.4 inches

Volume: 276.5 cubic inches

Handling Charge..$10.50

Storage Charge $9.28

Total Charges... $19.78

Sample Input #2:

Enter the company name: X-Ray Chemicals

Please enter your choice of shape from the following menu:

1. Cylinder

2. Sphere

3. Cone

4. Quit

Enter Menu Choice:? 2

Enter the radius of the sphere: ? 7.5

Sample Output:

Storage Bill for X-Ray Chemicals

Dimensions of the sphere:

Radius: 7.5 inches

Volume: 1767.1 cubic inches

Handling Charge..$15.25

Storage Charge $637.72

Total Charges... $652.97

Sample Input 3#:

Enter the company name: None

Please enter your choice of shape from the following menu:

1. Cylinder

2. Sphere

3. Cone

4. Quit

Enter Menu Choice:? 4

Sample Output:

Thanks for using this program!!!

Sample Input #4:

Enter the company name: Arkansas Industries

Please enter your choice of shape from the following menu:

1. Cylinder

2. Sphere

3. Cone

4. Quit

Enter Menu Choice:? 5

Sample Output:

Invalid menu choice Run program again.

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

Recommended Textbook for

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions

Question

How flying airoplane?

Answered: 1 week ago