211: Programming For IS 1 --- Program 3

Due Monday, October 25

Title: Converting Units

Topics covered:

Repetition Control Structure
Switch Control Structure
Menu-Driven Program

Purpose: Design a user-friendly, menu-driven program that will allow the user to convert between some standard metric and English units.

Description: This assignment involves designing a menu-driven program that will allow the user to convert between the following units, or quit the program. When converting temperature round to the nearest integer.

1. Kilometers to miles.
2. Miles to Kilometers.
3. Kilograms to pounds.
4. Pounds to kilograms.
5. Degrees centigrade to degrees Fahrenheit.
6. Degrees Fahrenheit to degrees centigrade.
7. Quit program.

Make your program as user-friendly as possible. After displaying a description of the program, the 7 options are displayed, and the user is prompted to input a number between 1 and 7 (representing an option). The user is then prompted to input the amount of units to be converted. The program should continue to run until the user enters 7.

Your program should check for invalid user entries. For example, if the user enters a number that is not between 1 and 7 then an error message followed by a repeat of the above menu should be displayed. Similarly, if the user enters a negative amount of inches, centimeters, pounds or kilograms then an error message and a repeat of the above menu should be displayed.

FYI

1 kilometer = 0.62 miles
1 kilogram = 2.2046 pounds
(x degrees) centrigrade = ((9/5)x + 32 degrees) Fahrenheit