HW6
HW6
Problem 1: Compute the overall average grade using the following two grading schemes.
Scheme I Scheme II
Homework 50% Homework 70%
Midterm Exam 25% Midterm Exam 10%
Final Exam 25% Final Exam 20%
• There are 6 homework assignments in total. Two lowest grades are dropped.
- vector of 6 doubles (homework), user input each with a for loop #1, find two lowest with for loop #2, erase them (somehow)
- reassign the vector to the 6 grades
• Each item’s grade is between 0 and 100, so the computed average should also be between 0 and 100.
okay
calculate grade based on each scheme
• The higher average between two grading schemes is used as the overall average.
- if-else if to find the which scheme is higher
• You need to implement two functions read grades and compute average. Infer the parameter list and return type from
main.cpp, where two functions have been called. You are not allowed to modify int main function.
• (25pt) read grades promotes users to enter grades. You can assume users will always enter valid inputs.
• (60pt) compute average returns the average grade computed from the schemes and also prints all grade items on the
console, including which grade items are dropped.
• main.cpp is already given and it shows how we plan to use the above two functions. You are not allowed to modify int
main.
• Here are some lines you may need to print the grades in the given format
cout << setw(12) << right << "Homework " << [hw#] << setw(8) << [grade]; cout << setw(13) << right <<
"Midterm Exam" << setw(8) << [grade];
Here are two samples when different grades are entered.
Homework 6 (100pt) PIC 10A
Instructions:
• All code must be written originally by yourself. You are not allowed to (even partially)
copy code from anyone else. Incident of cheating or plagiarism will be reported to the
Dean’s office and results in a zero grade in this assignment.
• (5pt) Put all functions including int main into one file, named average.cpp, and only
submit it to Gradescope. Declare the ownership in the beginning of your file.
• (10pt) Write your code with good coding practices, including commenting your code,
using descriptive variable names, etc.
• Code compiles with Visual Studio 2022 and solves the questions. Students may lose the
majority of points if their code doesn’t compile with VS 2022. To receive full credits, the
output must look EXACTLY the same as instructed above, including words, spaces,
symbols, etc. Your code should not only work for the above examples, but also work for
other different inputs.
To receive full credits, the output must look EXACTLY the same as instructed above,
including words, spaces, symbols, etc. Your code should not only work for the above
examples, but also work for other different inputs.