Question
Create a program that will calculate a students GPA using switch statements. The program should prompt the user for the number of courses (which determines
Create a program that will calculate a students 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 students 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]
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started