CIS 150 Programming Project: Input, output, calculations

Objectives

  • Create a working C++ program
  • Declare and use variables
  • Use cout to display literals
  • Use cout to display variable values
  • Perform simple calculations using C++

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. Declare five floating point variables for five scores that will be entered. Initialize them all to 0.0.
  4. Declare a string variable to hold a name that will be entered. Initialize it to a zero length string.
  5. Declare a floating point variable that will hold the average score. Initialize it to 0.0.
  6. Prompt the user for five scores, get them and store them for later. They should be floating point values.
  7. Prompt the user for their name and store it for later. Names including spaces must be accepted properly. Check the getline function for details on getting complete names and using cin.ignore() to eliminate extra newlines cin leaves behind in the input buffer.
  8. Calculate the average score and display it in a personalized message to the user which includes their name (see the example runs for details).

Example run

Enter score #1: 65 Enter score #2: 72 Enter score #3: 87.5 Enter score #4: 91.3 Enter score #5: 69 Enter name: Chauncey Gardener The average score for Chauncy Gardener is 76.96

Rubric

  • 3 points: Proper documentation comments
  • 5 points: Follows style guidelines used in class (proper indentation, no tabs, variable names start with lowercase letter, etc.)
  • 3 points: Variables properly declared and initialized
  • 4 points: Five scores properly prompted for and gotten from the user
  • 2 points: User input is done on the same line as the prompts
  • 2 points: Newline at end of last score entered properly dealt with before full name entered
  • 3 points: Full name properly prompted for and gotten from the user
  • 4 points: Average calculated properly
  • 4 points: Output message displays name and average (with any needed digits after the decimal point) correctly