Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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]

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

Database Management Systems Designing And Building Business Applications

Authors: Gerald V. Post

1st Edition

0072898933, 978-0072898934

More Books

Students also viewed these Databases questions