Create a C++ program to calculate grades as well as descriptive statistics for a set of test scores. The test scores can be entered via a user prompt or through an external file. For each student, you need to provide a student name (string) and a test score (float). The program will do the followings:
Assign a grade (A, B, C, D, or F) based on a student’s test score.
Display the grade roster as shown below:
Name Test Score Grade
Kyle 90 A
Matt 100 A
Carl 93 A
Calculate the following descriptive statistics:
Number of students in the class
Average score
Maximum score
Minimum score
Output example:
Number of students in the class: 3
Class Average: 94.3333
Maximum Test Score: 100
Minimum Test Score: 90
The program must use:
A loop structure (for-loop, while-loop, or do-while-loop)
Conditional processing (if-then-else)
Arrays
Classes and objects (separate theclass interface from the implementations)
Given below is the code for question. Please do rate the answer if it helped. Thank you.
student.h
--------
#ifndef STUDENT_H
#define STUDENT_H
#include
using namespace std;
class Student{
private:
string name;
double score;
public:
Student();
Student(string name1, double score1);
string getName();
double getScore();
char getGrade();
void setName(string s);
void setScore(double s);
};
#endif
student.cpp
-------
#include "student.h"
#include
using namespace std;
Student::Student(){
score = 0;
}
Student::Student(string name1, double score1){
name = name1;
score = score1;
}
void Student::setName(string s){
name = s;
}
void Student::setScore(double s){
score = s;
}
string Student::getName(){
return name;
}
double Student::getScore(){
return score;
}
char Student::getGrade(){
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';
}
student_main.cpp
-----
#include
#include
#include "student.h"
using namespace std;
int main(){
const int SIZE = 10;
Student s[SIZE];
int count = 0;
string choice;
string name;
double score;
double max, min, avg;
//input
do{
cout << "Enter name: ";
getline(cin, name);
cout << "Enter score: ";
cin >> score;
s[count].setName(name);
s[count].setScore(score);
count++;
cout << "Want to add another? (y/n): ";
cin >> choice;
cin.ignore(); //get rid of newline
}while(count < SIZE && ( choice == "y" || choice == "Y"));
max = min = s[0].getScore();
avg = 0;
for(int i = 0; i < count; i++){
if(s[i].getScore() > max)
max = s[i].getScore();
else if(s[i].getScore() < min)
min = s[i].getScore();
avg += s[i].getScore();
}
avg /= count;
cout << left << setw(15) << "Name" <<
setw(15) << "Score" << setw(15) << "Grade"
<< endl;
for(int i = 0; i < count; i++){
cout << setw(15) << s[i].getName() << setw(15)
<< s[i].getScore() << setw(15) << s[i].getGrade()
<< endl;
}
cout << endl;
cout << "Number of students: " << count <<
endl;
cout << "Class average: " << avg << endl;
cout << "Maximum score: " << max << endl;
cout << "Minimum score: " << min << endl;
return 0;
}

Create a C++ program to calculate grades as well as descriptive statistics for a set of...
in C++ Create a program that will calculate a student’s grade average of 5 test scores and assign a letter grade for a student. The program should use a class to store the student’s data including the student’s name and score on each of 5 tests. The program should include member functions to 1) get the student’s test scores, 2) calculate the average of the test scores, and 3) display the results as follows: Test scores for Mary: 100 90...
Java Program: In this project, you will write a program called GradeCalculator that will calculate the grading statistics of a desired number of students. Your program should start out by prompting the user to enter the number of students in the classroom and the number of exam scores. Your program then prompts for each student’s name and the scores for each exam. The exam scores should be entered as a sequence of numbers separated by blank space. Your program will...
[JAVA/chapter 7] Assignment: Write a program to process scores for a set of students. Arrays and methods must be used for this program. Process: •Read the number of students in a class. Make sure that the user enters 1 or more students. •Create an array with the number of students entered by the user. •Then, read the name and the test score for each student. •Calculate the best or highest score. •Then, Calculate letter grades based on the following criteria:...
In this assignment, you will write a program in C++ which uses files and nested loops to create a file from the quiz grades entered by the user, then reads the grades from the file and calculates each student’s average grade and the average quiz grade for the class. Each student takes 6 quizzes (unknown number of students). Use a nested loop to write each student’s quiz grades to a file. Then read the data from the file in order...
Write a complete C++ program that reads students names and their test scores from an input text file. The program should output each student’s name followed by the test scores and the relevant grade in an output text file. It should also find and display on screen the highest/lowest test score and the name of the students having the highest/lowest test score, average and variance of all test scores. Student data obtained from the input text file should be stored...
c++ Instructions Overview In this programming challenge you will create a program to handle student test scores. You will have three tasks to complete in this challenge. Instructions Task 1 Write a program that allocates an array large enough to hold 5 student test scores. Once all the scores are entered, the array should be passed to a function that sorts them in ascending order. Another function should be called that calculates the average score. The program should display the...
For C++ program Your program should first prompt the user for the number of students they wish to enter. For each student, the user will be prompted to enter the student’s name, how many tests the student has taken, and the grade for each test. Each test’s grade will be inputted as a number representing the grade for that test. Once each student’s information has been entered, the program will display the number of students. Additionally, each student will have...
please use the c language
Assignment 12 The program to write in this assignment is a program that calculates score statistics and manages the grades of the students. First, the student list and are given in a file named "student.dat" as in the following: 이성우 77 홍길동 88 scores 201 1710086 2012700091 This program reads the input file "student.dat" and keeps this data in a linear linked list. Each node must be a struct which contains the following: student id...
Write a c++ program which uses a structure having the indicated member names to store the following data: Name (student name) IDnum (student ID number) Tests (an array of three test scores) Average (average test score) Grade (course grade) The program will keep a list of three test scores for one student. The program may prompt the user for the name, ID number, and test scores, or these may be assigned within the program. The average test score will be...
in C porgraming . use #include〈stdio.h〉
#include〈stdlib.h〉
Assignment 12 The program to write in this assignment is a program that calculates score statistics and manages the grades of the students. First, the student list and scores are given in a file named "student.dat" as in the following: 이성우 77 홍길동 88 2011710086 2012700091 This program reads the input file "student.dat" and keeps this data in a linear linked list. Each node must be a struct which contains the following: student_id,...