Question: Write a C++ program that will calculate the volume of a rectangular prism and calculate gallons needed to fill it, in all units of measurement

Write a C++ program that will calculate the volume of a rectangular prism and calculate gallons needed to fill it, in all units of measurement (UOM).

Requirements:

Get input from the user

Get the unit of measurement (cm, in, or ft)

Validate the UOM (unit of measurement); restart if invalid

Get measurements (length, width, height)

Validate measurements (i.e., make sure theyre numbers); restart if invalid

Compute the volume using l*w*h

Display the results

Display the volume, including the chosen UOM

Convert the volume to one of the unchosen UOMs

Display the volume, including the first unchosen UOM

Convert the volume to the second unchosen UOM

Display the volume, including the second unchosen UOM

If user chose centimeter as UOM:

1. Display gallons needed per cubic centimeter [Volume (cm) * (1 *10-3) * (0.26417) = gallonPerCubicCentimeter ]

2. Display inch conversion [gallonPerCubicCentimeter * 16.387 = gallonPerCubicInch]

3. Display feet conversion [gallonPerCubicCentimeter * 28316.847 = gallonPerCubicFoot]

If user chose inches as UOM:

1. Display gallons needed per cubic inch [(Volume (in3)/231= gallonPerCubicInch]

2. Display centimeter conversion: [gallonPerCubicInch / 16.387 = gallonPerCubicCentimeter]

3. Display feet conversion: [gallonPerCubicInch * 1728 = gallonPerCubicFoot]

If user chose feet as UOM:

1. Display gallons needed per cubic foot: [(Volume (ft3) * 7.481 = gallonPerCubicFoot]

2. Display centimeter conversion: [gallonPerCubicInch / 28316.847 = gallonPerCubicFoot]

3. Display inch conversion: [gallonPerCubicInch / 1728 = gallonPerCubicFoot]

Volume Conversions:

1 cm = 0.393701 in = 0.0328084 ft

1 in = 2.54 cm = 0.0833333 ft

1 ft = 30.48 cm = 12 in

CubicCentimeters

length(inches) width(inches) height(inches) 16.387064 = centimeters(cm)

length(feet) width(feet) height(feet) 28316.846592 = centimeters(cm)

length(cm) width(cm) height(cm) = cubic centimeters(cm)

CubicFeet

length(feet) width(feet) height(feet) = cubic feet(cf)

length(inches) width(inches) height(inches) 1728 = cubic feet(cf)

length(cm) width(cm) height(cm) 28316.846592 = cubic feet(cf)

CubicInches

length(inches) width(inches) height(inches) = cubic inches(in)

length(feet) width(feet) height(feet) 1728 = cubic inches(in)

length(cm) width(cm) height(cm) 16.387064 = cubic inches(in)

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!