C++: Create a grade book program that includes a class of up to 20 students each with 5 test grades (4 tests plus a Final). The sample gradebook input file (CSCI1306.txt) is attached. The students’ grades should be kept in an array. Once all students and their test scores are read in, calculate each student’s average (4 tests plus Final counts double) and letter grade for the class.
The output of this program is a tabular grade report that is written to an output file (GradeReport.txt) The report includes each student’s name 5 test grades, test average and final grade as a table, and then print the averages of each Test and overall Test Average, as well as highest Test Grade of all Tests and the student(s) with the highest class grade.
76 89 150 135 200 76 12 100 150 28 178 189 167 200 175 150 87 99 129 149 176 200 87 35 157 189
Andrew Miller 87.5 89 65.75 37 98.5 John Doe 86 88 85.25 90 95 John Smith 52 82 79 88.5 85 Jane Deer 90 93 91 92.75 94 William Clinton 95 97 95.75 90 92 George Jones 89 81.5 75 85.25 88 Sarah White 75.5 78 85 88 84 Bill Able 88 90 86.75 91 93.5 Larry Brown 99 95 98 96.5 97 Amanda Ernst 76 79.5 77 82 84.25 Richard Farmer 84.75 87 80 85 86 Sam Green 87 91.75 85 88 90 Paula Hamilton 98 100 97.5 95 98.5 Jesus Javiar 77.5 82 85 78 86 Christy King 86 89.25 92 90 94.75 Bob Bush 70 75.5 77 79 81.25 Jerry Landers 95.5 97 96 92.75 94 Sally Moore 97 99 98.25 94 99 Nancy Nadler 91 93.25 90 89 92.5 Tina Templar 85 82 88.75 84 90
Code:
#include<iostream>
#include<iomanip>
#include<fstream>
#include<stdlib.h>
#include<string.h>
using namespace std;
struct GradeBook {
char FName[100];
char LName[100];
double s1, s2, s3, s4, s5;
double AverageGrades;
char LetterGrade;
};
struct GradeBook gBook[20];
class Students {
public:
double sumMarks, totalMarks;
double avgTest[5] = {0};
double avg;
double highestMarks;
void ReadFile(ifstream & inFile) {
inFile.open("grades.txt");
for (int i = 1; i <= 20; i++) {
inFile >> gBook[i].FName;
inFile >> gBook[i].LName;
inFile >> gBook[i].s1;
avgTest[0] += gBook[i].s1;
inFile >> gBook[i].s2;
avgTest[1] += gBook[i].s2;
inFile >> gBook[i].s3;
avgTest[2] += gBook[i].s3;
inFile >> gBook[i].s4;
avgTest[3] += gBook[i].s4;
inFile >> gBook[i].s5;
avgTest[4] += gBook[i].s5;
}
inFile.close();
}
public:
void printdata() {
for (int i = 1; i <= 20; i++) {
cout << setw(15) << left << gBook[i].FName;
cout << setw(15) << left << gBook[i].LName;
cout << setw(10) << left << gBook[i].s1;
cout << setw(10) << left << gBook[i].s2;
cout << setw(10) << left << gBook[i].s3;
cout << setw(10) << left << gBook[i].s4;
cout << setw(10) << left << gBook[i].s5 << endl;
}
}
public:
void FindGrades() {
avg = 0;
for(int i = 0; i < 5; i++){
avgTest[i] /= 20;
avg += avgTest[i];
}
avg /= 5;
sumMarks = 0, highestMarks = 0;
for (int i = 1; i <= 20; i++) {
totalMarks = (gBook[i].s1 + gBook[i].s2 + gBook[i].s3 + gBook[i].s4 + gBook[i].s5);
gBook[i].AverageGrades = totalMarks / 5;
if (gBook[i].AverageGrades > 80)
gBook[i].LetterGrade = 'A';
else if (gBook[i].AverageGrades > 70 && gBook[i].AverageGrades <= 80)
gBook[i].LetterGrade = 'B';
else if (gBook[i].AverageGrades > 60 && gBook[i].AverageGrades < 70)
gBook[i].LetterGrade = 'C';
else if (gBook[i].AverageGrades > 50 && gBook[i].AverageGrades < 60)
gBook[i].LetterGrade = 'D';
sumMarks = sumMarks + totalMarks;
if (highestMarks < gBook[i].AverageGrades) {
highestMarks = gBook[i].AverageGrades;
}
}
}
public:
void GradesReport(ofstream & outFile) {
outFile.open("GradeReport.txt");
outFile << setw(50) << setfill('#') << right << " Grades Report ";
outFile << setw(37) << right << "" << endl << endl;
outFile << setfill(' ') << setw(15) << left << "First Name";
outFile << setw(15) << left << "Last Name";
outFile << setw(10) << left << "Subject 1";
outFile << setw(10) << left << "Subject 2";
outFile << setw(10) << left << "Subject 3";
outFile << setw(10) << left << "Subject 4";
outFile << setw(10) << left << "Subject 5";
outFile << setw(15) << left << "Average Grades";
outFile << setw(15) << left << "Letter Grade" << endl;
cout << setw(50) << setfill('#') << right << " Grades Report ";
cout << setw(37) << right << "" << endl << endl;
cout << setfill(' ') << setw(15) << left << "First Name";
cout << setw(15) << left << "Last Name";
cout << setw(10) << left << "Subject 1";
cout << setw(10) << left << "Subject 2";
cout << setw(10) << left << "Subject 3";
cout << setw(10) << left << "Subject 4";
cout << setw(10) << left << "Subject 5";
cout << setw(15) << left << "Average Grades";
cout << setw(15) << left << "Letter Grade" << endl;
for (int i = 1; i <= 20; i++) {
outFile << setw(15) << left << gBook[i].FName;
outFile << setw(15) << left << gBook[i].LName;
outFile << setw(10) << left << gBook[i].s1;
outFile << setw(10) << left << gBook[i].s2;
outFile << setw(10) << left << gBook[i].s3;
outFile << setw(10) << left << gBook[i].s4;
outFile << setw(10) << left << gBook[i].s5;
outFile << setw(15) << left << gBook[i].AverageGrades;
outFile << setw(15) << left << gBook[i].LetterGrade << endl;
cout << setw(15) << left << gBook[i].FName;
cout << setw(15) << left << gBook[i].LName;
cout << setw(10) << left << gBook[i].s1;
cout << setw(10) << left << gBook[i].s2;
cout << setw(10) << left << gBook[i].s3;
cout << setw(10) << left << gBook[i].s4;
cout << setw(10) << left << gBook[i].s5;
cout << setw(15) << left << gBook[i].AverageGrades;
cout << setw(15) << left << gBook[i].LetterGrade << endl;
}
for(int i = 0; i < 5; i++){
cout << "\nAverage of Test " << i + 1 << " = " << avgTest[i];
outFile << "\nAverage of Test " << i + 1 << " = " << avgTest[i];
}
cout << "\n\nAverage of All tests = " << avg << endl;
outFile << "\n\nAverage of All tests = " << avg << endl;
cout << "\nThe Highest Average Grade is: " << highestMarks << endl;
outFile << "\nHighest Grade : " << highestMarks << endl;
cout << "\n GradeReport Saved Successfully to the Outputfile" << endl;
outFile.close();
}
};
int main() {
Students students;
cout << "\n------------------------------" << endl;
cout << "\n *** Students Book Records ***" << endl;
cout << "\n------------------------------" << endl;
ifstream inFile;
students.ReadFile(inFile); //reading input file.
cout << "\nThe Data from the input File is:" << endl;
students.printdata();
cout << "\nCalculating Grades..........." << endl;
students.FindGrades();
cout << "\n the Grade Report is " << endl;
cout << "\n------------------------------" << endl;
ofstream outFile;
students.GradesReport(outFile);
return 0;
}
grades.txt:
Output:
Console:
GradesReport.txt
C++: Create a grade book program that includes a class of up to 20 students each...
5. Mark’s class just took the admission test for business school and averaged 87.05. Chapter 10 Data Set 2 contains the population of scores for the 10 other classes in Mark’s university. How did Mark’s class do? Class 1 Class 2 Class 3 Class 4 Class 5 Class 6 Class 7 Class 8 Class 9 Class 10 78 81 96 85 88 78 90 79 96 86 77 78 97 90 88 82 86 93 87 89 78 93 88...
PLEASE SHOW ME HOW TO DO THIS.... For the Excel Data Set please find and report for Test 1 and Test 2 the Mean, SD, and the tolerance levels for both for which there would be any outliers (i.e., the value for which a score must be less than to be consider an outlier and the value for which a number must greater than to be considered an outlier. See picture Performance Data Group 1 1 1 1 Test 2...
ASAP HELP!! A test was given to 50 fourth grade students The scores for the students are given below. 93 108 91 116 92 87 100 88 109 110 91 119 88 100 86 119 113 85 103 118 100 112 87 95 95 94 114 87 119 96 113 100 112 100 107 93 91 95 111 108 110 88 117 101 88 97 118 87 114 103 (a) Construct a grouped frequency distribution for the data. Use 85-89...
write a program that uses a function to read in the grades for four classes and then uses a function to calculate the average grade in each of the classes. input the grades for one student. we will name her Beverly. output how Beverly's grade differs from each classe average. Make sure that your output is very clear. Below is your data: English 90 70 85 45 95 95 82 97 99 65 History 63 94 60 76 83 98...
Midterm1 = (83.33, 98.33, 75, 91.67, 96.67, 95, 86.67, 65, 100, 100, 80, 88.33, 96.67, 96.67, 90, 96.67, 86.67, 93.33, 80, 91.67, 98.33, 86.67, 85, 86.67, 95, 83.33, 96.67, 81.67, 98.33, 100, 95, 93.33, 91.67, 88.33, 98.33, 93.33, 98.33, 93.33, 85, 88.33, 100, 98.33, 96.67, 90, 86.67, 100, 96.67, 98.33, 90, 96.67, 86.67, 95, 78.33, 86.67, 100, 81.67, 96.67, 91.67, 96.67, 96.67, 95, 96.67, 73.33, 100, 93.33, 96.67, 88.33, 70, 96.67, 96.67, 100, 88.33, 96.67, 100, 88.33, 100, 78.33, 93.33,...
Please help me with this program.You are to write a C++ program that will read in up to 15 students with student information and grades. Your program will compute an average and print out certain reports. Format: The information for each student is on separate lines of input. The first data will be the student�s ID number, next line is the students name, next the students classification, and the last line are the 10 grades where the last grade is...
Student stress at final exam time comes partly from the uncertainty of grades and the consequences of those grades. Can knowledge of a midterm grade be used to predict a final exam grade? A random sample of 200 BCOM students from recent years was taken and their percentage grades on assignments, midterm exam, and final exam were recorded. Let’s examine the ability of midterm and assignment grades to predict final exam grades. The data are shown here: Assignment Midterm FinalExam...
The given data is the grades for people in this class. The goal here is to determine the factors that effect student's Grade in the class. 4) Find the mean and median for the men's and the women's Quizzes. Gender Men Women 5) Test the claim that the majority of students at this class are women. F M F F M F F F F M M F F F M F F F F M M F F M...
USE R AND SHOW CODES!! The IQ was measured for 35 twins. Is there any difference in IQ between twins? DATA Twin 1 Twin 2 113 109 94 100 99 86 77 80 81 95 91 106 111 117 104 107 85 85 66 84 111 125 51 66 109 108 122 121 97 98 82 94 100 88 100 104 93 84 99 95 109 98 95 100 75 86 104 103 73 78 88 99 92 111 108...
Problem #1: Consider the below matrix A, which you can copy and paste directly into Matlab. The matrix contains 3 columns. The first column consists of Test #1 marks, the second column is Test # 2 marks, and the third column is final exam marks for a large linear algebra course. Each row represents a particular student.A = [36 45 75 81 59 73 77 73 73 65 72 78 65 55 83 73 57 78 84 31 60 83...