Create a c++ program that will calculate the grade point average for a student.
ID: 668731 • Letter: C
Question
Create a c++ program that will calculate the grade point average for a student. The student will provide the letter grades for 10 courses. The program will read the 10 grades and convert the letter grade to a numeric value according to the table given below: Letter Value A 4 B 3.5 C 3 D 2.5 F 0 Then, the program will calculate the GPA taking into account the following number of credits for each course Course Credits @gmail.com>@gmail.com> MATH101 5 ENG100 3 BIO250 4 ITM100 3 CIS250 3 HIST101 3 CALC100 4 SCI201 3 SOC110 3 PHY100 4 @gmail.com>@gmail.com> The program will ask the student to enter the grades as follows: Grade for MATH101: Grade for ENG100: Grade for BIO250: Grade for ITM100: Grade for CIS250: Grade for HIST101: Grade for CALC100: Grade for SCI201: Grade for SOC110: Grade for PHY100: The program will use two arrays: one to store the 10 numeric grades and another one to store the number of credits for each course as given on the table above. Make sure to maintain the same order. The program will calculate the weighted average or GPA by multiplying each grade by its respective number of credits, adding all the products and dividing the total by the number of credits. GPA = left parenthesis sum subscript blank g r a d e asterisk times c r e d i t s right parenthesis divided by n u m b e r space o f space c r e d i t s The program output will be: You GPA is: X.XX The program must be fully documented with comments including a description@gmail.com>@gmail.com> Create a c++ program that will calculate the grade point average for a student. The student will provide the letter grades for 10 courses. The program will read the 10 grades and convert the letter grade to a numeric value according to the table given below: Letter Value A 4 B 3.5 C 3 D 2.5 F 0 Then, the program will calculate the GPA taking into account the following number of credits for each course Course Credits @gmail.com>@gmail.com> MATH101 5 ENG100 3 BIO250 4 ITM100 3 CIS250 3 HIST101 3 CALC100 4 SCI201 3 SOC110 3 PHY100 4 @gmail.com>@gmail.com> The program will ask the student to enter the grades as follows: Grade for MATH101: Grade for ENG100: Grade for BIO250: Grade for ITM100: Grade for CIS250: Grade for HIST101: Grade for CALC100: Grade for SCI201: Grade for SOC110: Grade for PHY100: The program will use two arrays: one to store the 10 numeric grades and another one to store the number of credits for each course as given on the table above. Make sure to maintain the same order. The program will calculate the weighted average or GPA by multiplying each grade by its respective number of credits, adding all the products and dividing the total by the number of credits. GPA = left parenthesis sum subscript blank g r a d e asterisk times c r e d i t s right parenthesis divided by n u m b e r space o f space c r e d i t s The program output will be: You GPA is: X.XX The program must be fully documented with comments including a description@gmail.com>@gmail.com> Create a c++ program that will calculate the grade point average for a student. The student will provide the letter grades for 10 courses. The program will read the 10 grades and convert the letter grade to a numeric value according to the table given below: Letter Value A 4 B 3.5 C 3 D 2.5 F 0 Then, the program will calculate the GPA taking into account the following number of credits for each course Course Credits @gmail.com>@gmail.com> MATH101 5 ENG100 3 BIO250 4 ITM100 3 CIS250 3 HIST101 3 CALC100 4 SCI201 3 SOC110 3 PHY100 4 @gmail.com>@gmail.com> The program will ask the student to enter the grades as follows: Grade for MATH101: Grade for ENG100: Grade for BIO250: Grade for ITM100: Grade for CIS250: Grade for HIST101: Grade for CALC100: Grade for SCI201: Grade for SOC110: Grade for PHY100: The program will use two arrays: one to store the 10 numeric grades and another one to store the number of credits for each course as given on the table above. Make sure to maintain the same order. The program will calculate the weighted average or GPA by multiplying each grade by its respective number of credits, adding all the products and dividing the total by the number of credits. GPA = left parenthesis sum subscript blank g r a d e asterisk times c r e d i t s right parenthesis divided by n u m b e r space o f space c r e d i t s The program output will be: You GPA is: X.XX The program must be fully documented with comments including a description@gmail.com>@gmail.com>Explanation / Answer
#include "stdafx.h"
#include <iostream> // Allows program to perform input and output.
using namespace std; // allows using cin and cout rather then std::cin and std::cout.
// Function main begains program execution.
int main()
{ // Starts function.
//Veriable declarations.
double Grade1; // Stores First grade in loop.
double Grade2; // Stores Second grade in loop.
double Grade3; // Stores Third grade in loop.
double AvgGrade; // average of entered grades.
double Total = 0; // Stores Combined value of grades per loop.
double AverageTotal = 0; // Holds running total of grades, Used for final Average.
int Students = 0; // Stores input of amount of students, Used to stop Counter.
int n = 0; // Used to calculate counter position.
int StudentNumber; // Used to output which student data is being requested for.
cout << "Enter the number of students in class : "; // Request amount of students for loop from user.
cin >> Students; // Store user entered value of students.
// used to vary the allowed amount of students based on user needs.
while (n < Students) {
StudentNumber = n + 1; // Calculate current Student number position.
cout << "Please enter three numeric grades for student number " << StudentNumber << ". "; // requesting grades imput from user.
cin >> Grade1; // Placing users first grade value to Grade1.
cin >> Grade2; // Placing users second grade value to Grade2.
cin >> Grade3; // Placing users third grade value to Grade3.
Total = (Grade1 + Grade2 + Grade3); // Calculate current grade total.
AverageTotal = AverageTotal + Total; // Store total grade for running total.
AvgGrade = (Total / 3); // Calculate average grade.
cout << "Student number " << StudentNumber << " grades: " << Grade1 << " " << Grade2 << " " << Grade3 << " average: " << AvgGrade << " "; // Output data to user about Grades using calculations of stored values.
n = n + 1; // add one to counter position.
// Selection of grade based on callculation of AvgGrade to display designated letter grade output.
if ( AvgGrade >= 90) // Grades 90 and above as "A"
cout << " letter grade: A! ";
else
if ( AvgGrade >= 80) // Grades 80-89 as "B"
cout << " letter grade: B. ";
else
if ( AvgGrade >= 70) // Grades 70-79 as "C"
cout << " letter: grade: C. ";
else
if ( AvgGrade >= 60) // Grades 60-69 as "D"
cout << " letter grade: D. ";
else // Grades 59 and less as "F"
cout << " letter grade: F. ";
cout << " "; // Adds new line between data to improve readability of program.
}
cout << "The class average: " << AverageTotal / (StudentNumber * 3) << " " ; // displays total class average based on running total and about of studends.
// Allows user to view data by creating a stop, user pressed key to return 0 value and exit program.
system("PAUSE");
return 0;
exit(1);
}