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:
Midterm:
Final Exam:
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 and
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 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:
Midterm:
Final Exam:
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: B: CD: or F
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 tests
Calculate Accumulated Average tests
Determine Letter Grade: tests, one for each letter grade
You must use the assert function to write your test cases to receive full credit 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 valid inputs:
Enter five homework scores :
Score :
Score :
Score :
Score :
Score :
Enter midterm score :
Enter final exam score :
Results
Average Homework Score:
Midterm Score:
Final Exam Score:
Accumulated Average:
Letter Grade: B
Running Example invalid homework input:
Enter five homework scores :
Score :
Invalid score. Please enter a value between and
Score :
Invalid score. Please enter a value between and
Score :
Score :
Score :
Score :
Invalid score. Please enter a value between and
Score :
Score :
Enter midterm score :
Enter final exam score :
Results
Average Homework Score:
Midterm Score:
Final Exam Score:
Accumulated Average:
Letter Grade: B
Running Example invalid midterm input:
Enter five homework scores :
Score :
Score :
Score :
Score :
Score :
Enter midterm score :
Invalid score. Please enter a value between and
Enter midterm score :
Enter final exam score :
Results
Average Homework Score:
Midterm Score:
Final Exam Score:
Accumulated Average:
Letter Grade: B
Running Example invalid final input:
Enter five homework scores :
Score :
Score :
Score :
Score :
Score :
Enter midterm score :
Enter final exam score :
Invalid score. Please enter a value between and
Enter final exam score :
Results
Average Homework Score:
Midterm Score:
Final Exam Score:
Accumulated Average:
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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
