Answer to Question #187344 in C++ for sara

Question #187344

Design a GPA calculator in which the student is allowed to enter maximum of 5 courses along with the course grade. The program should output the final GPA based on the scale below.


1
Expert's answer
2021-04-30T04:07:24-0400
include <iostream>


using namespace std;


int main()
{
    int i=1;
    int marks;
    int total=0;
    string description="";
    string course_name;
    string grade="";
    float grade_points=0.0;
    while (i<=5){
        cout<<"Enter Course Name : ";
        cin>>course_name;
        cout<<"Enter "<<course_name<<" marks : ";
        cin>>marks;
        total +=marks;
        i++;
    }
    
    if (total>=90 && total<=100){
        description="Excelent";
        grade="A";
        grade_points=4.00;
        
    }
    else if (total>=87 && total<=89){
        description="Very Good";
        grade="A-";
        grade_points=3.75;
        
    }
    else if (total>=84 && total<=86){
        description="Good";
        grade="B+";
        grade_points=3.35;
        
    }
    else if (total>=80 && total<=83){
        description="Good";
        grade="B";
        grade_points=3.00;
        
    }
    else if (total>=77 && total<=79){
        description="Good";
        grade="B-";
        grade_points=2.75;
        
    }
    else if (total>=74 && total<=76){
        description="Satisfactory";
        grade="C+";
        grade_points=2.50;
        
    }
    else if (total>=70 && total<=73){
        description="Average";
        grade="C";
        grade_points=2.00;
        
    }
    else if (total>=87 && total<=89){
        description="Below average";
        grade="C-";
        grade_points=1.75;
        
    }
    
    cout<<"Total Grade: "<<total<<endl;
    cout<<"Description: "<<description<<endl;
    cout<<"Grade: "<<grade<<endl;
    cout<<"Grade Points: "<<grade_points<<endl;


    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS