Lab 3: Units Conversion Class
Overview
This lab builds on the previous lab. You will refactor your conversion functions into a unit conversion class. Your program will convert between SI and "US" for 3 dimensions: length, volume, and pressure. As before, you will ask the user to choose the conversion, input a measurement, and provide the converted output.
-
Due Tues 6 Nov 2018 at midnight
-
Collect the the output of the required runs (below) in the editor of your choice (e.g., Office, Google Docs, etc.)
-
Export your document as a pdf (try "Print to PDF")
-
Your class should:
-
Be named
Converter
-
Be defined in a separate header file named
Converter.h
-
Contain member variables that hold the appropriate unit names (SI and US)
-
Contain exactly one member variable holding the conversion factor.
-
Contain one member function that
-
Returns void and takes a boolean (the direction of conversion)
-
Prompts the user for appropriate input, clearly stating the expected units
-
Outputs the converted input
-
Use exactly 2 decimal places of precision
-
Clearly state the output units
-
-
Your program should:
-
Construct one
Converter
object for each of 3 dimensions: length, volume, and pressure.-
Each object should be constructed only once in your program (i.e., outside the user input loop)
-
-
Prompt the user with numbered menu of available dimensions
-
read and verify user input
-
-
Prompt for the direction of conversion (SI to US, US to SI)
-
read and verify user input
-
-
Prompt for the measure to be converted
-
Assume the user provides input appropriate for type
double
.
-
-
Perform the appropriate conversion and output the response
-
Ask the user to quit or continue
-
If continue, proceed to the user menu (Step 3)
-