Hello, I need help with writing a C++ program that assigns curve grades to stude
ID: 3756503 • Letter: H
Question
Hello, I need help with writing a C++ program that assigns curve grades to students. Please find the codes and the dataset below, as well as the criteria for the curve grade assignment.
#include<iostream>
#include <string>
#include<fstream>
using namespace std;
//global declaration
const int MAXSTUDENT = 100;
const int BAR = 60;
enum GRADE { F, D, CMINUS, C, CPLUS, BMINUS, B, BPLUS, AMINUS, A };
//studnet class that has following personal data
class Student
{
private:
string nameFirst;
string nameLast;
double rawScore;
double percentRank;
GRADE pointGrade;
GRADE curveGrade;
string letterGrade;
public:
void setFirstName(string s)
{
nameFirst = s;
}
void setLastName(string s)
{
nameLast = s;
}
void setRawScore(double s)
{
rawScore = s;
}
void setPercent(double p)
{
percentRank = p;
}
void setPointGrade(GRADE g)
{
pointGrade = g;
}
void setCurveGrade(GRADE g)
{
curveGrade = g;
}
void setLetterGrade()
{
GRADE g;
if ((rawScore >= BAR) && (curveGrade >= pointGrade))
g = curveGrade;
else
g = pointGrade;
switch (g)
{
case F: letterGrade = "F"; break;
case D: letterGrade = "D"; break;
case CMINUS:letterGrade = "C-"; break;
case C: letterGrade = "C"; break;
case CPLUS: letterGrade = "C+"; break;
case BMINUS:letterGrade = "B-"; break;
case B: letterGrade = "B"; break;
case BPLUS: letterGrade = "B+"; break;
case AMINUS:letterGrade = "A-"; break;
case A: letterGrade = "A"; break;
}
}
string getFirstName()
{
return nameFirst;
}
string getLastName()
{
return nameLast;
}
double getRawScore()
{
return rawScore;
}
double getPercent()
{
return percentRank;
}
string getLetterGrade()
{
return letterGrade;
}
bool operator>(const Student&);
bool operator>=(const Student&);
bool operator==(const Student&);
bool operator<(const Student&);
bool operator<=(const Student&);
};
//Course class
class Course
{
private:
Student s[MAXSTUDENT];
int classSize;
double maxScore;
double minScore;
double avgScore;
public:
void grabData();
void setRank();
void assignPointGrade();
void assignCurveGrade();
void assignLetterGrade();
void displayGradeRoster();
//Sort the student's grades
void setRank()
{
for (int int = 0; i < classSize - 1; i++) {
for (int j = i + 1; j < classSize; j++) {
if (s[j].getRawScore() > s[i].getRawScore()) {
Student temp = s[i];
s[i] = s[j]
s[j] = temp;
}
}
}
}
};
int main()
{
Course c;
c.grabData();
c.setRank();
c.assignPointGrade();
c.assignCurveGrade();
c.assignLetterGrade();
c.displayGradeRoster();
return 0;
}
//open the file scores.dat
void grabdata()
{
// open file in read mode
ifstream in("scores.dat");
string namefirst;
string namelast;
double score;
// loop untill file ends
while (!in.eof())
{
// read the first name
in >> namefirst;
// read the last name
in >> namelast;
// read the score
in >> score;
cout << namefirst << " " << namelast << " " << score << endl;
}
// close the file
in.close();
}
See dataset below:
Eris Ahmetaj 68.24792627
Ashley Altomare 70.63162555
Magdalena Angelova 78.68855155
Michael Au 24.58952983
Jessica Aucaquizhpi 80.9651312
Ido Ayalon 58.44440228
Katarzyna Bagan 23.27771334
Kai Bakari 13.64586785
Anthony Bontatibus 40.46117218
Mackenzie Brown 19.09693455
Hung Cheung 61.5047475
Christopher Clark 22.82352941
Michelle Dai 16.84739022
Reynalyn Ella 66.64383415
Laura Enriquez 86.94117286
Anthony Esposito 72.9643276
Brian Facchin 28.48925021
Alexander Faisaly 68.98533298
John Farren 19.03065452
Tiago Ferreira 9.235294118
Max Gendler 67.96200054
Heather Getzinger 75.43251351
Lucia Gualan 55.84506415
Hermes Hamanot 21.47307374
Chetan Jagota 58.8054209
Nato Jangirashvili 54.95808485
Elisa Jean-leger 53.74135169
Danielle Jones 54.86847077
Anna Kashcheeva 58.81138069
Hanna Kasper 88.63630614
Romin Kershaw 63.62543833
Andrew Kim 19.24490472
Michelle Kot 51.9384831
Manwa Lam 52.15395319
Jennifer Lee 17.73653687
Min Lee 13.39705882
Andrew Li 39.34241922
Tommy Li 73.44118614
Andrew Lim 79.01404897
Hao Liu 74.36793946
Reginald Lominy 19.9907208
Elizabeth Lopez 17.74366197
Angie Lora 31.11374275
Alexander MakhiniaJr 92.62970814
Andresfelipe Mateusfajardo 31.63529412
Leo Mcfarlane 13.38455882
Adam Menken 58.212755
Leslie Mercedes 63.34457879
Miguel Meza 36.70836785
Na Miao 60.89740659
ChunJie Nan 62.31530921
Rosalie Nash 41.55579651
Tiffany Naula 19.54830157
Yareli Peralta 20.17776512
Francis Pho 62.63719346
Francisco Prieto 65.84856728
Kinga Pytko 74.04376611
Carolina QiuChen 30.88513877
Fadil Rahman 66.42208069
Ayman Razzaque 64.62214756
Elizabeth Rodriguez 28.47743323
Jonathan Selegean 51.20375414
Tal Shpatz 53.24363061
Julia Sinyavsky 14.88980944
Ilya Titov 71.10310654
Zita Tlupova 28.03562552
Jasmin Torres 86.30281919
Adam Vajdak 74.4810933
Jason Valladolid 54.50851482
Peter Vulaj 52.59323335
Wenjie Wang 48.50381797
Leah Wirth 68.41188217
Filip Wisniewski 80.62604983
See curve grade criteria below: please ignore the point cutoff column.
Thank you!
Curve cutoff Point cutoff (College Grade Scale) better than 90%of the class better than 75% of the class lx:Ucr thall (U% olthe class better than 45% of the class better than 35% of the class better than 25% of the class better than 15% of the class better than 10% of the class better than 5% of the class below 5% of the class higher than 93 points higher than 90 points linller that.xy points | higher than 83 points | higher than 80 points | higher than 77 points | higher than 73 points | higher than 67 points higher than 60 points lower than 60 points G AABBBCCCDFExplanation / Answer
Answer:
#include<iostream>
#include <string>
#include<fstream>
using namespace std;
//global declaration
const int MAXSTUDENT = 100;
const int BAR = 60;
enum GRADE { F, D, CMINUS, C, CPLUS, BMINUS, B, BPLUS, AMINUS, A };
//studnet class that has following personal data
class Student
{
private:
string nameFirst;
string nameLast;
double rawScore;
double percentRank;
GRADE pointGrade;
GRADE curveGrade;
string letterGrade;
public:
void setFirstName(string s)
{
nameFirst = s;
}
void setLastName(string s)
{
nameLast = s;
}
void setRawScore(double s)
{
rawScore = s;
}
void setPercent(double p)
{
percentRank = p;
}
void setPointGrade(GRADE g)
{
pointGrade = g;
}
void setCurveGrade(GRADE g)
{
curveGrade = g;
}
void setLetterGrade()
{
GRADE g;
if ((rawScore >= BAR) && (curveGrade >= pointGrade))
g = curveGrade;
else
g = pointGrade;
switch (g)
{
case F: letterGrade = "F"; break;
case D: letterGrade = "D"; break;
case CMINUS:letterGrade = "C-"; break;
case C: letterGrade = "C"; break;
case CPLUS: letterGrade = "C+"; break;
case BMINUS:letterGrade = "B-"; break;
case B: letterGrade = "B"; break;
case BPLUS: letterGrade = "B+"; break;
case AMINUS:letterGrade = "A-"; break;
case A: letterGrade = "A"; break;
}
}
string getFirstName()
{
return nameFirst;
}
string getLastName()
{
return nameLast;
}
double getRawScore()
{
return rawScore;
}
double getPercent()
{
return percentRank;
}
string getLetterGrade()
{
return letterGrade;
}
bool operator>(const Student&);
bool operator>=(const Student&);
bool operator==(const Student&);
bool operator<(const Student&);
bool operator<=(const Student&);
};
//Course class
class Course
{
private:
Student s[MAXSTUDENT];
int classSize;
double maxScore;
double minScore;
double avgScore;
public:
void grabData();
void assignPointGrade();
void assignCurveGrade();
void assignLetterGrade();
void displayGradeRoster();
//Sort the student's grades
void setRank()
{
for (int i = 0; i < classSize - 1; i++)
{
for (int j = i + 1; j < classSize; j++)
{
if (s[j].getRawScore() > s[i].getRawScore())
{
Student temp = s[i];
s[i] = s[j];
s[j] = temp;
}
}
}
}
};
int main()
{
Course c;
c.grabData();
c.setRank();
//c.assignPointGrade();
//c.assignCurveGrade();
//c.assignLetterGrade();
//c.displayGradeRoster();
return 0;
}
//open the file scores.dat
void Course:: grabData()
{
// open file in read mode
ifstream in("Source.dat");
string namefirst;
string namelast;
double score;
int i=0;
// loop untill file ends
while (!in.eof())
{
// read the first name
in >> namefirst;
s[i].setFirstName=namefirst;
// read the last name
in >> namelast;
s[i].setLastName=namefirst;
// read the score
in >> score;
s[i].setRawScore=score;
//cout << namefirst << " " << namelast << " " << score << endl;
}
// close the file
in.close();
}
budy just tell me how to set point grade curve grade there is any formula for it i just read the file and fill the strudent object array with it.so please tell me about it i will do it for you.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.