Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

Question Question You’ll be prompting a student for grades and credits for courses taken. From that, you will calculate a GPA.

Question

You’ll be prompting a student for grades and credits for courses taken. From

that, you will calculate a GPA.

This site: http://www.back2college.com/gpa.htm shows you how to calculate a GPA.

Keep prompting the student if they want to add more courses.

IMPORTANT NOTES!

  • The course name is prompted for, but nothing is done with it.
  • We are just using the grades A, B, C, D, and F so you won’t have to do so much typing!
  • You will need to use the “set precision” command as shown in the book. Set it to “fixed” and “2”.
  • You will need to use the “cin.ignore()” function as discussed earlier in the course.

==========

I am encountering an error within my coding and I can’t seem to pinpoint it. For the most part everything else is correct.

#include <iostream>

#include <string>

using namespace std;

int main(){

int credits, gradePoints;

int totalGrade, totalCredits = 0;

string name, grade;

string response = “Yes”;

float gpa = 0.00;

double num;

while(response == “Yes”){

cout<<“Enter a course name: “;

cin>> name;

cin>> num;

cout<< name;

cout<<” “;

cout<< num;

cout<< endl;

cout<<“Enter number of credits: “;

cin>> credits;

cout<< credits;

cout<< endl;

cout<<“Enter your grade (A, B, C, D, F): “;

cin>> grade;

cout<< grade;

cout<< endl;

if(grade == “A”){

gradePoints = (4*credits);

totalGrade = totalGrade + gradePoints;

}

else if(grade == “B”){

gradePoints = (3*credits);

totalGrade = totalGrade + gradePoints;

}

else if(grade == “C”){

gradePoints = (2*credits);

totalGrade = totalGrade + gradePoints;

}

else if(grade == “D”){

gradePoints = (1*credits);

totalGrade = totalGrade + gradePoints;

}

else if(grade == “F”){

gradePoints = (0*credits);

totalGrade = ((totalGrade) + (gradePoints));

}

cout<<“Continue (‘Yes’ or ‘No’)? “;

cin>> response;

cout<< response;

cout<< endl;

totalCredits = ((totalCredits) + (credits));

gpa = ((totalGrade) / (totalCredits));

}

cout<<“Total grade points: ” << gradePoints << endl;

cout<<“Total credits attempted: ” << totalCredits << endl;

cout<<“Your GPA is ” << gpa << endl;

return 0;

}

========

Error included

Running Test 1                                                                                                                                                                                                                                                

==================== YOUR OUTPUT =====================                                                                                                                                                                                                       

=================== MISMATCH FOUND ON LINE 0013: ===================                                                                                                                                                                                          

ACTUAL  : Total~grade~points:~1                                                                                                                                                                                                                               

EXPECTED: Total~grade~points:~22                                                                                                                                                                                                                              

======================================================                                                                                                                                                                                                        

Adjust your program and re-run to test.                                                                                                                                                                                                                       

Test 1 failed                                                                                                                                                                                                     

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"