Calculate and list GPA information for a single student. (input Enter manually)
ID: 3675428 • Letter: C
Question
Calculate and list GPA information for a single student. (input Enter manually)
SAMPLE INPUT
Prompt the user to enter data from table below.
A student can take a minimum of one course and a maximum of seven courses during a semester.
Use the table below to verify the accuracy of the data entered by the user. When the user enters invalid data, display an appropriate error message and prompt the user to re-enter the value. Continue to prompt the user until user enters a valid value for the field.
PROCESSING
Calculate and list the following GPA information:
Semester 2 standard (unweighted) GPA
Semester 2 weighted GPA
Semester 1 standard (unweighted) GPA
Semester 1 weighted GPA
Cumulative standard (unweighted) GPA
Cumulative unweighted GPA
To calculate standard G.P.A., total the credit hours (Cr Hrs), compute the grade points for each course and then total the grade points. Divide the total grade points earned by the total credit hours. Use the chart below to convert a letter grade to a standard GPA on a 4.0 scale:
Source: College Board, How to Convert Your GPA to a 4.0 Scale, Retrieved from http://www.collegeboard.com/html/academicTracker-howtoconvert.html
For purposes of this assignment, to calculate a weighted GPA, for honors and AP courses, add .50 to the 4.0 scale points. For example if an A grade is earned in an Honors or AP course, then the A grade is worth 4.5 points, not 4.0 points. An unweighted or standard GPA uses the 4.0 scale; it does not assign any extra points for Honors or AP courses.
To calculate cumulative G.P.A., for all semesters total the credit hours (Cr Hrs) and then total the grade points. Divide the total grade points earned by the total credit hours.
SAMPLE OUTPUT
Semester 2: Standard GPA = 2.950 Weighted GPA = 3.283
Semester 1: Standard GPA = 3.294 Weighted GPA = 3.559
CUMULATIVE GPA
Standard GPA = 3.117 Weighted GPA = 3.417
SPECIAL INSTRUCTIONS
Attach and submit you program as a single .cpp file.
Classes and objects are not required for this assignment. If you choose to write an object-oriented program that uses classes and objects, you must place all of your code in a single .cpp file.
Do not include any of the following C++ programming features:
Functions
Arrays or Vectors
emester Course Title Course Type Cr Hrs Grade German 2 AP Math 2 Biology Honors English Composition Chemistry 2 Honors AP World Histor ular Honors Regular Honors Course Title Course Type Regular emester Cr Hrs Grade German 1 AP Math 1 Chemistry 1 Honors Art English Literature AP US History Honors Regular Regular AP 2Explanation / Answer
// include required header files
#include <iostream>
using namespace std;
int main() {
int semesterOneCreditHours = 0;
double semesterOneGradePoint = 0.0;
double semesterOneWeightedGradePoint = 0.0;
int semesterTwoCreditHours = 0;
double semesterTwoGradePoint = 0.0;
double semesterTwoWeightedGradePoint = 0.0;
for (int i = 1; i <= 2; ++i) {
cout << "Enter semester " << i << " data for 6 subjects: " << endl;
for (int j = 1; j <= 6; ++j) {
string courseTitle = "N/A";
string courseType = "N/A";
int creditHours = -1;
string grade = "N/A";
while (courseTitle == "N/A") {
cout << "Enter course title: ";
getline(cin, courseTitle);
if (courseTitle == "N/A") {
cout << "Error! Course title can not be empty. Please re-enter. ";
}
}
while (courseType != "Regular" && courseType != "AP" && courseType != "Honors") {
cout << "Enter course type: ";
cin >> courseType;
if (courseType != "Regular" && courseType != "AP" && courseType != "Honors") {
cout << "Error! Course title must be one of Regular, AP or Honors. ";
}
}
while (creditHours <= 0 || creditHours > 4) {
cout << "Enter credit hours: ";
cin >> creditHours;
if (creditHours <= 0 || creditHours > 4) {
cout << "Error! Credit hours should be an integer from 1 to 4. ";
}
}
while (grade != "A+" && grade != "A" && grade != "A-"
&& grade != "B+" && grade != "B" && grade != "B-"
&& grade != "C+" && grade != "C" && grade != "C-"
&& grade != "D+" && grade != "D"
&& grade != "E" && grade != "F") {
cout << "Enter grade: ";
cin >> grade;
if (grade != "A+" && grade != "A" && grade != "A-"
&& grade != "B+" && grade != "B" && grade != "B-"
&& grade != "C+" && grade != "C" && grade != "C-"
&& grade != "D+" && grade != "D"
&& grade != "E" && grade != "F") {
cout << "Error! Please enter correct grade input. ";
}
}
double gradePoints;
if (grade == "A+") gradePoints = 4.0;
else if (grade == "A") gradePoints = 4.0;
else if (grade == "A-") gradePoints = 3.7;
else if (grade == "B+") gradePoints = 3.3;
else if (grade == "B") gradePoints = 3.0;
else if (grade == "B-") gradePoints = 2.7;
else if (grade == "C+") gradePoints = 2.3;
else if (grade == "C") gradePoints = 2.0;
else if (grade == "C-") gradePoints = 1.7;
else if (grade == "D+") gradePoints = 1.3;
else if (grade == "D") gradePoints = 1.0;
else if (grade == "E" || grade == "F") gradePoints = 0.0;
if (i == 1) {
semesterOneCreditHours += creditHours;
semesterOneGradePoint += creditHours * gradePoints;
if (courseType == "AP" || courseType == "Honors") {
gradePoints += 0.5;
}
semesterOneWeightedGradePoint += creditHours * gradePoints;
} else {
semesterTwoCreditHours += creditHours;
semesterTwoGradePoint += creditHours * gradePoints;
if (courseType == "AP" || courseType == "Honors") {
gradePoints += 0.5;
}
semesterTwoWeightedGradePoint += creditHours * gradePoints;
}
string temp;
getline (cin, temp);
}
}
printf("Semester 2: Standard GPA = %.3lf Weighted GPA = %.3lf ",
semesterTwoGradePoint / semesterTwoCreditHours, semesterTwoWeightedGradePoint / semesterTwoCreditHours);
printf("Semester 1: Standard GPA = %.3lf Weighted GPA = %.3lf ",
semesterOneGradePoint / semesterOneCreditHours, semesterOneWeightedGradePoint / semesterOneCreditHours);
printf("CUMULATIVE GPA ");
printf("Standart GPA = %.3lf Weighted GPA = %.3lf ",
(semesterTwoGradePoint + semesterOneGradePoint) / (semesterOneCreditHours + semesterTwoCreditHours),
(semesterOneWeightedGradePoint + semesterTwoWeightedGradePoint) / (semesterOneCreditHours + semesterTwoCreditHours));
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.