Help me with GPA calculation
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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. A, B- , B+ with credit hours [3 5 5]
b. B+, C-, D with credit hours [5 4 3]
This is what I have..
clear
clc
for u = 1:2;
c = input('Enter Your Grade','s')
e = input('Enter Credit hours')
switch c
case A;
disp(4.0);
case A-;
disp(3.7);
case B+;
disp(3.3);
case B;
disp(3.0);
case B-;
disp(2.7);
case C+;
disp(2.3);
case C;
disp(2.0);
case C-;
disp(1.7);
case D+;
disp(1.4);
case D;
disp(1.0);
case D-;
disp(0.7);
case E;
disp(0);
end
end
and I am kinda stuck on it. Help me people
0 Commenti
Risposte (1)
Vedere anche
Categorie
Scopri di più su Startup and Shutdown in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!