Question: Functionality: Create a program that allows the user to: a . Input five homework scores. b . Calculate and display the total and average of

Functionality:
Create a program that allows the user to:
a. Input five homework scores.
b. Calculate and display the total and average of the homework scores.
c. Input midterm and final exam scores.
d. Calculate and display the accumulated average based on the weights:
Homework: 40%
Midterm: 30%
Final Exam: 30%
e. Determine and display the corresponding letter grade based on the accumulated average.
Input Validation:
Ensure all inputs are valid:
Homework, midterm, and final scores must be between 0 and 100.
Prompt the user until valid input is provided.
Function Specifications
Below are the detailed specifications for each function, including their names, parameters, and return values:
getHomeworkScores()
Description: Collects five homework scores from the user and calculates their total.
Parameters: None.
Return Value: - the total of the five homework scores.
calculateHomeworkAverage
Description: Calculates the average of the homework scores.
Parameters:
the total of the homework scores.
int numHomeworks (default =5)- the number of homework assignments.
Return Value: double - the average of the homework scores.
calculateAccumulatedAverage
Description: Calculates the weighted average of homework, midterm, and final scores.
Homework: 40%
Midterm: 30%
Final Exam: 30%
Parameters:
double homeworkAvg - the average homework score.
double midterm - the midterm score.
double finalExam - the final exam score.
Return Value: double - the accumulated average.
determineLetterGrade
Description: Determines the letter grade based on the accumulated average.
Parameters:
double average - the accumulated average.
Return Value: char - the letter grade ( A:100-90, B: 89-80,C>=79-70,D:69-60, or F <60).
testFunctions
Description: Tests all functions using assertions to ensure correctness.
Parameters: None.
Return Value: None.
Include tests using assertions ( cassert ) for the following functions to validate their correctness.
Test scenarios should cover:
Calculate Homework Average (2 tests)
Calculate Accumulated Average (2 tests)
Determine Letter Grade: (5 tests, one for each letter grade)
You must use the assert function to write your test cases to receive full credit (20%) for the test cases.
inputAndProcess
Description: Manages user input, calls the necessary functions for calculation, and displays the results.
Parameters: None.
Return Value: None.
Running Example 1(valid inputs):
Enter five homework scores (0-100):
Score 1: 85
Score 2: 90
Score 3: 78
Score 4: 88
Score 5: 92
Enter midterm score (0-100): 80
Enter final exam score (0-100): 87
--- Results ---
Average Homework Score: 86.60
Midterm Score: 80.00
Final Exam Score: 87.00
Accumulated Average: 84.28
Letter Grade: B
Running Example 2(invalid homework input):
Enter five homework scores (0-100):
Score 1: -10
Invalid score. Please enter a value between 0 and 100.
Score 1: 105
Invalid score. Please enter a value between 0 and 100.
Score 1: 85
Score 2: 95
Score 3: 78
Score 4: 101
Invalid score. Please enter a value between 0 and 100.
Score 4: 88
Score 5: 92
Enter midterm score (0-100): 100
Enter final exam score (0-100): 80
--- Results ---
Average Homework Score: 87.60
Midterm Score: 100.00
Final Exam Score: 80.00
Accumulated Average: 89.04
Letter Grade: B
Running Example 3(invalid midterm input):
Enter five homework scores (0-100):
Score 1: 85
Score 2: 90
Score 3: 78
Score 4: 88
Score 5: 92
Enter midterm score (0-100): 101
Invalid score. Please enter a value between 0 and 100.
Enter midterm score (0-100): 80
Enter final exam score (0-100): 87
--- Results ---
Average Homework Score: 86.60
Midterm Score: 80.00
Final Exam Score: 87.00
Accumulated Average: 84.74
Letter Grade: B
Running Example 4(invalid final input):
Enter five homework scores (0-100):
Score 1: 85
Score 2: 90
Score 3: 78
Score 4: 88
Score 5: 92
Enter midterm score (0-100): 80
Enter final exam score (0-100): -20
Invalid score. Please enter a value between 0 and 100.
Enter final exam score (0-100): 87
--- Results ---
Average Homework Score: 86.60
Midterm Score: 80.00
Final Exam Score: 87.00
Accumulated Average: 84.74
Letter Grade: B
Notes:
The running examples provided during the exam may differ from the zyBooks' test cases. Please refer to the actual results from the
zyBooks submission for accuracy.
If you have any questions about the instructions, please raise them during the exam. Once the exam is over, any ambiguity or
confusion regarding the exam instructions will not be considered.
Additionally, the zyBooks score is for your reference only. After the exam, I will review your code for correctness. Your score may be
reduced if I find any issues or logical errors in your code.
C++ please

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!