CIS 150 C++ Programming Project: Selection, output formatting

Objectives

  1. Use selection
  2. Get user input
  3. Perform calculations
  4. Demonstrate output formatting

Program requirements

  1. Include documentation comments at the start of the file.
  2. Follow the course style guidelines including indentation, naming conventions, spaces instead of tabs, etc.
  3. Display a menu with four options as follows:
      Convert inches to:
      1. feet
      2. yards
      3. centimeters
      4. meters
      
      Enter choice: 
  4. Get the menu choice from the keyboard.
  5. If the user entered a choice not available on the menu, display an error message and end the program.
  6. If the user entered a valid choice, prompt the user for and get the number of inches. This should be required to be an integer (NOT a floating point number).
  7. Do the appropriate conversion and display the result with a meaningful message. Feet and yards must display integer values. Centimeters and meters must display floating-point values with one digit after the decimal point.

Conversion formulas

Points

Example runs

Note: These example runs show several runs of the sample program.

Convert inches to:
1. feet
2. yards
3. centimeters
4. meters

Enter choice: 6
Error: Invalid menu choice

Convert inches to:
1. feet
2. yards
3. centimeters
4. meters

Enter choice: 1
Enter the number of inches: 27
That is 2 feet, 3 inches

Convert inches to:
1. feet
2. yards
3. centimeters
4. meters

Enter choice: 2
Enter the number of inches: 99
That is 2 yards, 2 feet, 3 inches

Convert inches to:
1. feet
2. yards
3. centimeters
4. meters

Enter choice: 3
Enter the number of inches: 27
That is 68.6 centimeters

Convert inches to:
1. feet
2. yards
3. centimeters
4. meters

Enter choice: 4
Enter the number of inches: 27
That is 0.7 meters