Answer to Question #28669 in C++ for Isaac Frimpong

Question #28669
Write an application to calculate the CGPA of a student over a period of 1 – 4 years.
• Your application should be able to calculate the CGPA over an assigned duration with range of 1-4 years
• There should be 2 semesters within every year.
• Courses for each semester should always be limited to 5
• Applications should allow users to enter grades for courses taken
o Example : Course 1 : A
Course 2 : C
Course 3 : B+
• Application should be able to print output of GPA for each semester and Total CGPA
NB
• Employ the use of switch conditional statements as well within your code structure
• Additional Marks will be given for clarity, comments and proper indentation of code.
1
Expert's answer
2013-04-17T11:26:23-0400
// ArraysortProgram.cpp :Defines the entry point for the console application.
//

#include "stdafx.h"
#include "Arraysort.h"
#include <conio.h>
#include <iostream>
#include <string>

using namespace std;

//convert feom letter to numeric
double Convertedtonumericvalues(string letter){

float numericvalues=0;//variable for numericvalues
if(letter=="A"){
numericvalues=4.0;
}
if(letter=="A-"){
numericvalues=3.7;
}
if(letter=="B+"){
numericvalues=3.3;
}
if(letter=="B-"){
numericvalues=2.7;
}
if(letter=="C+"){
numericvalues=2.3;
}
if(letter=="C"){
numericvalues=2.0;
}
if(letter=="C-"){
numericvalues=1.7;
}
if(letter=="D+"){
numericvalues=1.3;
}
if(letter=="D"){
numericvalues=1;
}
if(letter=="D-"){
numericvalues=0.7;
}
if(letter=="F"){
numericvalues=0;
}
return numericvalues;//return numericvalues
}
//main function
int main()
{
double CGPA=0;
string CourseLetter;//variable for CourseLetter
for(int i=0;i<4;i++){
//enter Courses
cout<<"Course "<<(i+1)<<" : ";
cin>>CourseLetter;
CGPA+=Convertedtonumericvalues(CourseLetter);//add to total
}
cout<<"Total CGPA is: "<<CGPA;//show Total CGPA
getch();//delay
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
APPROVED BY CLIENTS