Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

write a program that calculates the average of an arbitrary number of grades inp

ID: 1937438 • Letter: W

Question

write a program that calculates the average of an arbitrary number of grades inputted by the user. this can be done by continuously prompting the user for additional number. in the event the user inputs a negative number the data entry shall stop, and the average shall be computed and displayed. finally based on the average print the letter grade using the standard 10 points grading scale for As,Bs,Cs,Cs,Ds, and Fs.

Explanation / Answer

#include #include using namespace std; int main() { //-| ---------------------------------------------------------------- //-| Declare Variables //-| ---------------------------------------------------------------- string Name; //-| Name of student int ID; //-| Student's ID number float GPA; //-| Student's GPA char letterGrades; //-| The students letter grade int creditHours; //-| Credit Hours for each course //-| ---------------------------------------------------------------------------- //-| 1. 1. Initialize: letter grade counts, hoursTaken, coursesTaken, qualityPts. //-| ---------------------------------------------------------------------------- int Acount = 0; int Bcount = 0; int Ccount = 0; int Dcount = 0; int Fcount = 0; int hoursTaken = 0; float coursesTaken = 0; float qualityPts = 0; //-| ---------------------------------------------------------------- //-| 2a. Read student ID and full name. 2b. Prompt: Enter ID and Name: //-| ---------------------------------------------------------------- cout letterGrades; //-| ---------------------------------------------------------------- //-| 4. Repeat while (not the END MARKER) //-| 4a. update coursesTaken //-| 4b. update hoursTaken //-| 4c. update qualityPts and grade counts based on letter grade //-| and creditHours //-| ---------------------------------------------------------------- while (creditHours != 0 || letterGrades != 'X') {coursesTaken = coursesTaken++; hoursTaken = hoursTaken + creditHours; if (letterGrades == 'A') { Acount = Acount + 1;} if (letterGrades == 'B') { Bcount = Bcount + 1;} if (letterGrades == 'C') { Ccount = Ccount + 1;} if (letterGrades == 'D') { Dcount = Dcount + 1;} if (letterGrades == 'F') { Fcount = Fcount + 1;} qualityPts = qualityPts + (4*Acount+3*Bcount+2*Ccount+1*Dcount); cin >> creditHours; cin >> letterGrades; } //-| --------------------------------------------------------------------- //-| 5. Compute GPA = qualityPts / hoursTaken; //Avoid divide by zero //-| --------------------------------------------------------------------- GPA = qualityPts / coursesTaken; //-| --------------------------------------------------------------------- //-| 6. Print the GPA report in this format: //-| //-| =========================================== //-| STUDENT ID: xxxxxxxxx //-| STUDENT NAME: xxxxxxxxxxxxxxxxxxxxxxx //-| //-| LETTER GRADE: A B C D F //-| COUNT: xx xx xx xx xx //-| //-| COURSES TAKEN: //-| HOURS TAKEN: xxx //-| STUDENT GPA: x.xx //-| =========================================== //-| //-| ---------------------------------------------------------------------- cout