If you have any doubts, please give me comment...
#include<iostream>
#include<iomanip>
#include<vector>
#include<cstdlib>
using namespace std;
const int NUM_STUDENTS = 5;
const int NUM_SCORES = 4;
const int CREDITS[] = {2, 2, 4, 1};
struct Student{
int idNumber;
int raw_scores[NUM_SCORES];
char letter_grades[NUM_SCORES];
int weighted_scores[NUM_SCORES];
int totalPoints;
double gpa;
};
char getLetterGrade(int score);
int gradePoints(char grade);
int main(){
vector<Student> scores;
Student temp;
for(int i=0; i<NUM_STUDENTS; i++){
bool alreadyExist = true;
while(alreadyExist){
temp.idNumber = (rand()%9998)+1;
alreadyExist = false;
for(int j=0; j<i; j++){
if(scores[j].idNumber==temp.idNumber){
alreadyExist = true;
break;
}
}
}
temp.totalPoints = 0;
for(int j=0; j<NUM_SCORES; j++){
temp.raw_scores[j] = (rand()%40)+60;
temp.letter_grades[j] = getLetterGrade(temp.raw_scores[j]);
temp.weighted_scores[j] = gradePoints(temp.letter_grades[j])*CREDITS[j];
temp.totalPoints += temp.weighted_scores[j];
}
temp.gpa = (double)temp.totalPoints/NUM_SCORES;
scores.push_back(temp);
}
cout<<setw(4)<<"ID"<<" ";
for(int i=0; i<NUM_SCORES; i++){
cout<<"S"<<(i+1)<<" G"<<(i+1)<<" ";
}
cout<<"Total GPA"<<endl;
for(int i=0; i<NUM_STUDENTS; i++){
cout<<setw(4)<<setfill('0')<<scores[i].idNumber<<" ";
for(int j=0; j<NUM_SCORES; j++){
cout<<scores[i].raw_scores[j]<<" "<<scores[i].letter_grades[j]<<" ";
}
cout<<scores[i].totalPoints<<" "<<scores[i].gpa<<endl;
}
return 0;
}
char getLetterGrade(int score){
if(score>90)
return 'A';
else if(score>80)
return 'B';
else if(score>70)
return 'C';
else if(score>60)
return 'D';
else
return 'F';
}
int gradePoints(char grade){
if(grade=='A')
return 4;
else if(grade=='B')
return 3;
else if(grade=='C')
return 2;
else if(grade=='D')
return 1;
else
return 0;
}
use c++ Weighted GPA Calculator2 Many schools factor in the number of credits each course is...
Problem Specification:Write a C++ program to calculate student’s GPA for the semester in your class. For each student,the program should accept a student’s name, ID number and the number of courses he/she istaking, then for each course the following data is needed the course number a string e.g. BU 101 course credits “an integer” grade received for the course “a character”.The program should display each student’s information and their courses information. It shouldalso display the GPA for the semester. The...
A student earned grades of Upper A, Upper F, Upper A, Upper D, and Upper C. Those courses had the corresponding numbers of credit hours 4, 4, 2, 4, and 3. The grading system assigns quality points to letter grades as follows: Aequals4; Bequals3; Cequals2; Dequals1; Fequals0. Compute the grade point average (GPA) as a weighted mean and round the result with two decimal places. If the Dean's list requires a GPA of 3.00 or greater, did this student make...
Task: You want to calculate a student's GPA for a number of classes taken by the student during a single semester. (In C# (C sharp)) Inputs: 1. the student's name 2. Class names for the classes taken by the student 3. Class letter grade for the classes taken by the student 4. Class credit hours for the classes taken by the student Processing: 1. Accept and process classes until the user indicates they are finished 2. accumulate the number of...
A. Create a CollegeCourse class. The class contains fields for the course ID (for example, CIS 210), credit hours (for example, 3), and a letter grade (for example, A). Include get and set methods for each field. Create a Student class containing an ID number and an array of five CollegeCourse objects. Create a get and set method for the Student ID number. Also create a get method that returns one of the Student’s CollegeCourses; the method takes an integer...
A. Create a CollegeCourse class. The class contains fields for the course ID (for example, CIS 210), credit hours (for example, 3), and a letter grade (for example, A). Include get and set methods for each field. Create a Student class containing an ID number and an array of five CollegeCourse objects. Create a get and set method for the Student ID number. Also create a get method that returns one of the Student’s CollegeCourses; the method takes an integer...
A. Create a CollegeCourse class. The class contains fields for the course ID (for example, CIS 210), credit hours (for example, 3), and a letter grade (for example, A). Include get and set methods for each field. Create a Student class containing an ID number and an array of five CollegeCourse objects. Create a get and set method for the Student ID number. Also create a get method that returns one of the Student’s CollegeCourses; the method takes an integer...
You will create a class to store information about a student�s courses and calculate their GPA. Your GPA is based on the class credits and your grade. Each letter grade is assigned a point value: A = 4 points B = 3 points C = 2 points D = 1 point An A in a 3 unit class is equivalent to 12 grade points (4 for the A times 3 unit class) A C in a 4 unit class is...
The following is solved using C++ in Vocareum: In this problem, you will 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...
C++ program For research purposes and to better help students, the admissions office of your local university wants to know how well female and male students perform in certain courses. You receive a file confidentiality, the letter code f is used for female students and m for male students. Every file in the file is unknown. Write a program that computes and outputs the average GPA for both (ECPartIData.txt) that contains female and male student GPAs for certain courses. Due...
One common system for computing a grade point average (GPA) assigns 4 points to an A, 3 points to a B, 2 points to a C, 1 point to a D, and 0 points to an F. What is the GPA of a student who gets an A in a 3-credit course, a B in each of two 2-credit courses, a C in a 3-credit course, and a D in a 2-credit course?