Your program should take an input scale,
and an input measurement. It further needs to take an output scale,
which the input measurement must be converted to. In other words,
you need to convert a measurement in one scale into a measurement in another
scale (i.e. 12 inches to 1 foot, or 3 feet to one meter...etc..).
Your program should allow the user to specify any input scale in the range
[ inches, feet, meters, and centimeters ] and should allow the user to
specify any output scale in the range [ inches, feet, meters, and centimeters
]. Should the user specify the same input and output ranges you should
recognize this and output the original measurement without further computation.
The input that your program must accept
for scales is a word that is the entire word of the scale (i.e. inches)
or only the first letter (i.e. i), and further must not care about case,
though only of the first letter, as any further problems of case are the
users problem (i.e. Inches is the same as inches). Should the user
specify a scale that does not exist, then the program should output an
error message, and end without further processing.
This assignment is due by midnight on June 15. (You
are therefore given 8 days)
Knowledge you should need to do this assignment:
A sample run of the program should appear thusly:
User input is bolded for clarity.
Successful runs of the program:
Example 1
% convert
What is the scale of the original measurement?
inches
What is the measurement?
3.4
What is the scale to convert this number into?
feet
The converted measurement is: 0.2833
feet.
Example 2
% convert
What is the scale of the original measurement?
Feet
What is the measurement?
2.7
What is the scale to convert this number into?
inches
The converted measurement is: 32.4 inches.
Error conditions:
Example 3
% convert
What is the scale of the original measurement?
fEet
I am sorry that is not a valid scale.
Example 4
% convert
What is the scale of the original measurement?
don'tcare
I am sorry that is not a valid scale.