CSCI 240 | Spring 2025 |
For this assignment, write a program to calculate a student's course average in the CSCI 240 course.
The cpp file that is submitted for grading must be named assign1.cpp.
The first thing to do in the program is to create any variables that are needed to hold/save information for the program. To determine how many variables are needed, think about the information that will be entered by someone using the program and whether it is important for that information to be saved. Think about any calculations that will be performed by the program and whether the results of the calculations need to be saved. To determine the data type for the variables, think about what type of values that someone using the program will be entering or what kind of results will be produced by any calculations. (Note: to ease into writing this first program, the data type for the variables has been specified below.)
Ask the student for their program average. This is a value that can have a decimal point and should be saved in a float 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 student for their dailies average. This is a value that can have a decimal point and should be saved in a float 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 student for their combined exam and quiz average. This is a value that can have a decimal point and should be saved in a float 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 calculated course average as follows:
Your current course average is [average].
where the [average] is replaced by the calculated course average. There should be exactly 1 space before the calculated course average and a period immediately after the calculated course average. Make sure the display is preceded by exactly 2 blank lines and is ended with exactly 1 newline character.
Name the cpp file that is submitted for grading assign1.cpp.
At the top of the C++ source code, include a documentation box that resembles the following, making sure to replace the "Semester" label with the current semester and year, put your name after the "Programmer" label, the section of CSCI 240 that you're in after the "Section" label, and the due date for the program after the "Date Due" label. A box similar to this one will be put in EVERY source code file that is handed in this semester.
Note: DO NOT put this box within cout statements. It should NOT be displayed as part of the output from the program.
/*************************************************************** CSCI 240 Program 1 Spring 2025 Programmer: Section: Date Due: Purpose: This program calculates and displays a course average for the CSCI 240 course. ***************************************************************/
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.
The variable names used in the program must be meaningful.
Make sure to test the program with values other than the ones shown in the output below.
Hand in a copy of the source code (the CPP file) on the autograder and Blackboard.
A few runs of the program should produce the following results:
What is your program average? 75.6421 What is your dailies average? 55.3333 What is your exam/quiz average? 74.321 Your current course average is 71.8692.
What is your program average? 95.22 What is your dailies average? 92.1445 What is your exam/quiz average? 91.3 Your current course average is 92.6027.
What is your program average? 100 What is your dailies average? 100.0 What is your exam/quiz average? 100 Your current course average is 100.
When the program is run on the autograder, the output will resemble the following. Notice that the input values are not displayed.
What is your program average? What is your dailies average? What is your exam/quiz average? Your current course average is 71.8692.