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

Problem: Generate a grade report, given a list of students and their scores, and

ID: 3566851 • Letter: P

Question

Problem: Generate a grade report, given a list of students and their scores, and a grading scheme.

USE ARRAYS, IOMANIP AND FSTREAM

step 1:read a text file with the students grades of labs, exams, homeworks, and the project.
step 2:calculate the average scores of labs, exams, and homeworks for every student in the record.
step 3: calculate the final weighted score according to established grading scheme and average scores of the four individual parts of the course for every student in the record.
step 4:calculate the final letter grade based on the final weighted average for every student in the record.
step 5:determine the highest scorer of the class and their final weighted score.
step 6: determine the lowest scorer of the class and their final weighted score.


Grading scheme: labs 15%, exams 40%, homeworks 25%, project 20%.

Grade record example:
John 100 100 90 95 85 100 90 100 100 98 75
Tom 90 92 82 95 89 93 95 97 96 98 92
ect.
1st column is the name, 2-6 are grades for labs, 7-8 are grades for exams, 9-11 are homework grades, and the last number is the project.

Once you have the weighted total computed, assign a letter grade using the following grade
scale: 90%

Problem: Generate a grade report, given a list of students and their scores, and a grading scheme. USE ARRAYS, IOMANIP AND FSTREAM step 1:read a text file with the students grades of labs, exams, homeworks, and the project. step 2:calculate the average scores of labs, exams, and homeworks for every student in the record. step 3: calculate the final weighted score according to established grading scheme and average scores of the four individual parts of the course for every student in the record. step 4:calculate the final letter grade based on the final weighted average for every student in the record. step 5:determine the highest scorer of the class and their final weighted score. step 6: determine the lowest scorer of the class and their final weighted score. Grading scheme: labs 15%, exams 40%, homeworks 25%, project 20%. Grade record example: John 100 100 90 95 85 100 90 100 100 98 75 Tom 90 92 82 95 89 93 95 97 96 98 92 ect. 1st column is the name, 2-6 are grades for labs, 7-8 are grades for exams, 9-11 are homework grades, and the last number is the project. Once you have the weighted total computed, assign a letter grade using the following grade scale: 90%a??99%, A; 80%a??89%, B; 70%a??79%, C; 60%a??69%, D; and 0%a59%, F. You can use a if else chain to assign letter grades, but if you use a switch statement to assign the grades you will receive BONUS points. You should Format the output neatly in well-aligned rows and columns and write the data to an output file as shown below:

Explanation / Answer

Program code:

//Header file StudentGrades.h

#ifndef StudentGrades_H

#define StudentGrades_H

#include <string>

using namespace std;

class StudentGrades

{

public:

     string studname;

     int labGrads[5];

     int gradesOfExam[2];

     int hwGrades[3];

     int projectGrade;

     StudentGrades();

     void setName(string name);

     void setLabGrades(int lg[], int size);

     void setGradesOfExam(int gox[2]);

     void sethwGrades(int hwg[3]);

     void setProjectGrade(int pg);

     string getName();

     int* getLabGrades();

     int* getGradesOfExam();

     int* gethwGrades();

     int getProjectGrade();

     double getLabGradeAverage();

     double getGradeExamAverage();

     double getHWGradeAverage();

     double getTotalScore();

     double getWeightedScore();

     char letterGrade(double avg);

   

};

#endif

// StudentGrades.cpp

#include "stdafx.h"

#include "StudentGrades.h"

#include <iostream>

#include <iomanip>

#include <string>

using namespace std;

StudentGrades::StudentGrades()

{}

void StudentGrades::setName(string name)

{

     studname=name;

}

void StudentGrades::setLabGrades(int lg[], int size)

{

     for(int i=0;i<5;i++)

     {

          labGrads[i]=lg[i];

     }

}

void StudentGrades::setGradesOfExam(int gox[2])

{  

     gradesOfExam[0]=gox[0];

     gradesOfExam[1]=gox[1];

}

void StudentGrades::sethwGrades(int hwg[3])

{  

     hwGrades[0]=hwg[0];

     hwGrades[1]=hwg[1];

     hwGrades[2]=hwg[2];

}

void StudentGrades::setProjectGrade(int pg)

{

     projectGrade=pg;

}

string StudentGrades::getName()

{

     return studname;

}

int* StudentGrades::getLabGrades()

{  

          return labGrads;

}

int* StudentGrades::getGradesOfExam()

{  

     return gradesOfExam;

}

int* StudentGrades::gethwGrades()

{  

     return hwGrades;

}

int StudentGrades::getProjectGrade()

{

     return projectGrade;

}

double StudentGrades::getLabGradeAverage()

{

     int total=0;

     double avg;

     int *b=getLabGrades();

     for(int i=0;i<5;i++)

          total+=b[i];

     avg=total/5;

     return avg;

}

double StudentGrades::getGradeExamAverage()

{

     int total=0;

     double avg;

     int *b=getLabGrades();

     for(int i=0;i<2;i++)

          total+=b[i];

     avg=total/2;

     return avg;

}

double StudentGrades::getHWGradeAverage()

{

     int total=0;

     double avg;

     int *b=getLabGrades();

     for(int i=0;i<3;i++)

          total+=b[i];

     avg=total/3;

     return avg;

}

double StudentGrades::getWeightedScore()

{

     double labscore=getLabGradeAverage()*15/100;

     double examscore=getGradeExamAverage()*40/100;

     double hwscore=getHWGradeAverage()*25/100;

     double projectscore=getProjectGrade()*20/100;

     double weightedScore=0;

     weightedScore=labscore+examscore+examscore+projectscore;

     return weightedScore;

}

double StudentGrades::getTotalScore()

{

     double labscore=getLabGradeAverage();

     double examscore=getGradeExamAverage();

     double hwcore=getHWGradeAverage();

     double projectscore=getProjectGrade();

     double totalScore=0;

     totalScore=labscore+examscore+examscore+projectscore;

     return totalScore;

}

char StudentGrades::letterGrade(double avg)

{

     char ch;

     if(avg>=90 && avg <=99)

     {

          ch='A';

     }

     else if(avg>=80 && avg <=89)

     {

          ch='B';

     }

     else if(avg>=70 && avg <=79)

     {

          ch='C';

     }

     else if(avg>=60 && avg <=69)

     {

          ch='D';

     }

     else if(avg>=0 && avg <=59)

     {

          ch='F';

     }

     return ch;

}

#include "stdafx.h"

#include "StudentGrades.h"

#include <iostream>

#include <iomanip>

#include <fstream>

#include <vector>

using namespace std;

int main()

{

     vector<StudentGrades> student;

     string name;

     int count=0;

     int lb[5];

     int exg[2];

     int hwg[3];

     int prg;

     ifstream myfile ("studentData.txt");

     if (myfile.is_open())

     {

          while ( !myfile.eof() )

          {

              if(myfile.eof())

              {

                   break;

              }

            

              myfile >> name;

              student[count].setName(name);

              myfile >> lb[0];

              myfile >> lb[1];

              myfile >> lb[2];

              student[count].setLabGrades(lb, 5);

              myfile >> exg[0];

              myfile >> exg[1];

              student[count].setGradesOfExam(exg);

              myfile >> hwg[0];

              myfile >> hwg[1];

              myfile >> hwg[2];

              student[count].sethwGrades(hwg);

              myfile >> prg;

              student[count].setProjectGrade(prg);

          }

          count++;

     }

     myfile.close();

     ofstream examfile("Output.txt");

     if (examfile.is_open())

     {

          examfile <<" "<<setw(20)<<"Student Report"<<endl;

          examfile <<" "<<"StudentName"<<setw(5)<<"AvgOfLabExam"<<setw(5)

              <<"AvgOfExam"<<setw(5)<<"AvgOfHW"<<setw(5)<<"Project"

              <<setw(5)<<"WeightedAvg"<<setw(5)<<"Grade"<<endl;

          for(int i=0;i<student.size(); i++)

          {

              examfile << cout<<student[i].getName()

                   <<setw(5)<<student[i].getLabGradeAverage()

                   <<setw(5)<<student[i].getGradeExamAverage()

                   <<setw(5)<<student[i].getHWGradeAverage()

                   <<setw(5)<<student[i].getProjectGrade()

                   <<setw(5)<<student[i].getWeightedScore()

                   <<setw(5)<<student[i].letterGrade(student[i].getWeightedScore());

          }

          double temp=0;

          for(int i=0;i<student.size();i++)

          {

              if(student[i].getTotalScore()>temp)

                        temp=student[i].getTotalScore();

          }

          examfile<<"The heightest score is "<<setw(10)<<temp<<endl;

          double temp1=0;

          for(int i=0;i<student.size();i++)

          {

              if(student[i].getTotalScore()<temp1)

                        temp=student[i].getTotalScore();

          }

          examfile<<"The lowest score is "<<setw(10)<<temp1<<endl;

        

     }

     examfile.close();

   

     system("pause");

     return 0;

}

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