Create a program that will calculate a student’s GPA using switch statements. Th
ID: 3670871 • Letter: C
Question
Create a program that will calculate a student’s GPA using switch statements. The program should prompt the user for the number of courses (which determines a for loop counter). Then the program will ask for the letter grade (string variable) and the credit hours for that course. It will take those inputs and then calculate the student’s GPA based on the following 4.0 grading scale. Add the credit hours and the grade point hours on each pass through the loop. Upon completion of the loop, calculate the final grade point average (grade point hours/credit hours).
Hint: keep 2 scalar running totals in the loop: (1) total_hours, and (2) total_earned
Letter Grade
Grade Points
A
4.0
A-
3.7
B+
3.3
B
3.0
B-
2.7
C+
2.3
C
2.0
Letter Grade
Grade Points
C-
1.7
D+
1.3
D
1.0
D-
0.7
E
0.0
Test your program with the following two cases:
A, B- , B+ with credit hours [3 5 5]
B+, C-, D with credit hours [5 4 3]
Letter Grade
Grade Points
A
4.0
A-
3.7
B+
3.3
B
3.0
B-
2.7
C+
2.3
C
2.0
Explanation / Answer
Please find the required code below :
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.