we have an array to store marks for a particular student. The array stores a per
ID: 3633659 • Letter: W
Question
we have an array to store marks for a particular student. The array stores a percentage for each of the 5 components: Tutorials, MT1, MT2, Assignments, FinalExam.float marks[5];
We also have an array that stores the relative weight of the marks in the course grading scheme, i.e., how much each of the components is worth towards your mark in the course, e.g, 8%, 10%, 10%, 32%, 40%.
float weights[5];
Write a program that asks the user for 5 percentage grades, storing them in the marks[] array, and then calculates the student's final mark, using the weighting scheme stored in weights[]. The calculated final grade should be displayed to the console??
Explanation / Answer
You would get the 5 floats from the user and check each for validity (assuming no possibility of extra credit, between 0.00 and 1.00, inclusive.) You'd put the 5 valid values in marks[0] thru [4] (assuming C++ uses 0-based arrays...it's been a while.) You also put the values 0.08, 0.1, 0.1, 0.32 and 0.4 in weights[0] thru [4], respectively. Initialize float finalScore to 0.0 and then use a for loop like so: for i=0, iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.