Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In this project, you are asked to design, develop, implement, and test a prototy

ID: 3715841 • Letter: I

Question

In this project, you are asked to design, develop, implement, and test a prototype (a model) for an exam grading software system. This system will read the students' ID numbers, names and their answers to a multiple choice test from a file. The user will enter the Answer Key. The program will also create and display a Grade Report consisting of the Students' ID, Name, Answers, Total Points Earned, Average, and Letter Grade sorted in ascending order by the Student Name. Another report will also be created and display the students' grouped by the Letter Grade Earned. This report will display the Student ID, Name, Total Points, Average, and Letter Grade also sorted in ascending order by Student Name (see sample output). The basic requirements for such a system include the following: 1. Student Registration: Students taking the exam are entered into the grading system via an input file. The file contains the students' ID numbers, names, and answers to a multiple choice exam. 2. Grading: The user enters an “Answer Key" and then the system grades the students' answers and calculates the students' total points, average, and letter grade earned (you are not required to perform data validation); 3. Grade Reporting: The system generates a report (in ascending order by Student Name) of each student's ID, name, exam answers, total points, average and letter grade earned; Analysis Reporting: The system produces 5 reports (in ascending order by Student Name), grouped by Letter Grade earned that includes the Student ID, Name, Total Points, Average, and Letter Grade. The Letter Grade earned is based on the student's average using the Grading Scale below: A = 90-100% B = 80-89% C = 70-79% D = 60-69 % F = 59% and below

Explanation / Answer

Solution:

#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <iterator>
#include <cstring>

using namespace std;

void readDataFromFile();
void calculateResult();
void displayResult();
void removeCharsFromString( string &str);

char file_name[20] = "student.txt";
int total_record = 0;

char answer_keys[10];

struct Student {
int stud_id;
string full_name, answers;
char letter_grade;
double total_points, avg;
  
int operator=(const Student& s) {
this->stud_id = s.stud_id;
this->full_name = s.full_name;
this->letter_grade = s.letter_grade;
this->answers = s.answers;
this->total_points = s.total_points;
this->avg = s.avg;
return 0;
}
  
}record[50];

void StudentSort() {
int i, j;
Student check;

for(i=1; i<total_record; i++) {
check = record[i];
for(j=i; j>=1 && (check.full_name < record[j-1].full_name); j--) {
record[j] = record[j-1];
record[j-1] = check;
}
}
}

int main()
{
  
readDataFromFile();
  
   cout << endl << "-------------------------------";
   cout << endl << "Enter Answer Keys : " ;
   for(int i=0; i<10; i++) {
   cout << endl << "Answer " << i+1<< " : ? " ;
   cin >> answer_keys[i];
   }
  
   calculateResult();
   displayResult();
  
return 0;
}

void readDataFromFile() {

ifstream ifile;
ifile.open(file_name);
  
total_record = 0;
  
string line = "";
while (! ifile.eof()) {
getline (ifile, line);
string id = line.substr(0, line.find(" "));
record[total_record].stud_id = atoi(id.c_str());
record[total_record].full_name = line.substr(line.find(" ") + 1);
line = "";
getline (ifile, line);
record[total_record].answers = line;
total_record ++ ;
}
if(total_record > 0)
total_record -- ;
ifile.close();
StudentSort();
}

void calculateResult() {
  
cout << endl << "-------------------------------------------------------------------------------------";
cout << endl << "Grade Report" << endl ;
cout << endl << "Student ID Student Name Answers Total Pts Average Letter Grade ";
cout << endl << "-------------------------------------------------------------------------------------";
  
for (int i=0; i < total_record; i++) {
removeCharsFromString(record[i].answers);
  
int points = 0;
for(int j=0; j<10; j++) {
if(record[i].answers[j] == answer_keys[j]) {
points += 5;
}
}
record[i].total_points = points;
record[i].avg = (points * 100 / 50);
  
if(record[i].avg >= 90) {
record[i].letter_grade = 'A';
} else if(record[i].avg >= 80 && record[i].avg <= 89) {
record[i].letter_grade = 'B';
} else if(record[i].avg >= 70 && record[i].avg <= 79) {
record[i].letter_grade = 'C';
} else if(record[i].avg >= 60 && record[i].avg <= 69) {
record[i].letter_grade = 'D';
} else {
record[i].letter_grade = 'F';
}
  
cout << endl << setw(4) << record[i].stud_id<< setw(22) << record[i].full_name << setw(12)<< record[i].answers << setw(8) << record[i].total_points << setw(8) << record[i].avg<< setw(8) << record[i].letter_grade;
}
  
}

void displayResult() {
  
cout << endl << "--------------------------------------------------------------------";
cout << endl << "Student Admitted to the Graduate Program" << endl ;
cout << endl << "Student ID Student Name Total Pts Average Letter Grade ";
cout << endl << "--------------------------------------------------------------------";
  
for (int i=0; i < total_record; i++) {
if(record[i].letter_grade == 'A' || record[i].letter_grade == 'B' || record[i].letter_grade == 'C')
cout << endl << setw(4) << record[i].stud_id<< setw(22) << record[i].full_name << setw(8)<< record[i].total_points << setw(8) << record[i].avg << setw(8) << record[i].letter_grade;
}
  
cout << endl << "--------------------------------------------------------------------";
cout << endl << "Student with Conditional Admission to the Graduate Program" << endl ;
cout << endl << "Student ID Student Name Total Pts Average Letter Grade ";
cout << endl << "--------------------------------------------------------------------";
  
for (int i=0; i < total_record; i++) {
if(record[i].letter_grade == 'D')
cout << endl << setw(4) << record[i].stud_id<< setw(22) << record[i].full_name << setw(8)<< record[i].total_points << setw(8) << record[i].avg << setw(8) << record[i].letter_grade;
}
  
cout << endl << "--------------------------------------------------------------------";
cout << endl << "Student not Allowed Admission"<< endl ;
cout << endl << "Student ID Student Name Total Pts Average Letter Grade ";
cout << endl << "--------------------------------------------------------------------";
  
for (int i=0; i < total_record; i++) {
if(record[i].letter_grade == 'F')
cout << endl << setw(4) << record[i].stud_id<< setw(22) << record[i].full_name << setw(8)<< record[i].total_points << setw(8) << record[i].avg << setw(8) << record[i].letter_grade;
}
}

void removeCharsFromString( string &str) {
str.erase( remove(str.begin(), str.end(), ' '), str.end() );
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote