CSCI 240 Spring 2026

Assignment 2
Formatted Output and Symbolic Constants
(75 points)


Due: Friday, January 30 on the autograder and Blackboard by 11:59 PM

Overview

For this assignment, write a program to calculate a course average in the CSCI 240 course.

The cpp file that is submitted for grading should be named assign2.cpp

Basic Program Logic

The basic logic for this program is similar to program 1: the user is asked to enter values, a calculation is performed, and the results of the calculations are displayed.

Ask the user of the program for their program average. This value should be saved in a double variable. The prompt to the user must be "What is your program average?". There should be exactly 1 space after the question mark.

Ask the user of the program for their dailies average. This value should be saved in a double variable. The prompt to the user must be "What is your dailies average?". There should be exactly 1 space after the question mark.

Ask the user of the program for their combined exam and quiz average. This value should be saved in a double variable. The prompt to the user must be "What is your exam/quiz average?". There should be exactly 1 space after the question mark.

Use the three averages entered by the user to calculate the course average. The course average is equal to the sum of 30% of the program average, 15% of the dailies average, and 55% of the combined exam and quiz average.

Finally, display the three averages entered by the user and the calculated course average. Each value should be preceded by a label and should be displayed with EXACTLY 3 digits after the decimal point.

There should be a single new line character before displaying the output and at the end of the output. There should also be a blank line between the display of the values input by the user and the calculated course average.

Symbolic Constants

This program MUST use at least 3 symbolic constants.

The first constant is for the percentage of the program average that is used to calculate the course average. Depending on how the calculation is coded for the course average, this constant should have a value of 0.30 or 30.

The second constant is for the percentage of the dailies average that is used to calculate the course average (15%).

The third constant is for the percentage of the combined exam and quiz average that is used to calculate the course average (55%).

More symbolic constants may be added to the code if necessary.

Assignment Requirements

  1. At the top of the C++ source code, include a documentation box that resembles the one from Assignment 1. Make sure the Date Due and Purpose are updated to reflect the current program.

  2. Include line documentation. There is no need to document every single line, but logical "chunks" of code should be preceded by a line or two that describes what the "chunk" of code does. This will be a part of every program that is submitted for the remainder of the semester.

  3. The values should be displayed with exactly 3 digits after the decimal point, including zeroes.

  4. Use setw() to display the values. Field sizes of 16, 16, 10, and 17 were used to display the program, dailies, exam/quiz, and course values, respectively. The values can be adjusted based on how the cout statements are coded, but each line is ultimately a total of 31 characters.

  5. The program MUST use the 3 symbolic constants described above.

  6. Make sure to test the program with values other than the ones shown in the output below.

  7. Hand in a copy of the source code (the CPP file) on the autograder and Blackboard.

Output

A few runs of the program should produce the following results:

Run 1

What is your program average? 75.6421
What is your dailies average? 55.3333
What is your exam/quiz average? 74.321

Program Average          75.642
Dailies Average          55.333
Exam and Quiz Average    74.321

Course Average           71.869

Run 2

What is your program average? 95.22
What is your dailies average? 92.1445
What is your exam/quiz average? 91.3

Program Average          95.220
Dailies Average          92.144
Exam and Quiz Average    91.300

Course Average           92.603

Run 3

What is your program average? 100
What is your dailies average? 100.0
What is your exam/quiz average? 100

Program Average         100.000
Dailies Average         100.000
Exam and Quiz Average   100.000

Course Average          100.000