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

The program should read test scores students received on the first quiz of CSCI

ID: 3646794 • Letter: T

Question

The program should read test scores students received on the first quiz of CSCI 2010 into an array.

Write functions to:

?Prompt the user how many students are in class and then read the original scores into a dynamically created array.
?Compute the distribution of scores according to the following scheme, i.e., count number of As, Bs, etc.

A: 90--?100
B: 80--?89
C: 70--?79
D: 60--?69
F: 0--? 59

?Find How many students have the same score.

?Display number of students, the distribution of scores, and number of students with the same score.

Each bullet above should implemented as a function, which is then called by main().

Additional requirements

?Do Not use reference parameters in your functions.
?Pass all arrays to functions as pointers

THIS IS WHAT I HAVE SO FAR: However, I need it not to have a set number of students and not to have a sentinal. and I need all that in the lastScores function. Help me please. I am so close to having this done.

#include <iostream>
#include <iomanip>
#include <string>

using namespace std;

void introductions();

void report(int *scorePointer, int &index, int &numberA, int &numberB, int &numberC, int &numberD, int &numberF, int &students, int &testScore);

void lastScores(int *scorePointer, int &index, const int &LENGTH, int &counter, const int &SENTINAL, int &numberA, int &numberB, int &numberC, int &numberD, int &numberF);

void Grades(int *scorePointer, int &index, int &numberA, int &numberB, int &numberC, int &numberD, int &numberF);

void sameGrades(int *scorePointer, int &index, int &students, int &testScore);

int main()
{
const int LENGTH = 20;
int grade[LENGTH];
int *scorePointer = grade;
int index;
int counter = 1;
const int SENTINAL = -999;
int numberA = 0;
int numberB = 0;
int numberC = 0;
int numberD = 0;
int numberF = 0;
int students = 0;
int testScore = 0;






lastScores(scorePointer, index, LENGTH, counter, SENTINAL, numberA, numberB, numberC, numberD, numberF);

report(scorePointer, index, numberA, numberB, numberC, numberD, numberF, students, testScore);

system ("pause");
return 0;
}




void report(int *scorePointer, int &index, int &numberA, int &numberB, int &numberC, int &numberD, int &numberF, int &students, int &testScore)
{
cout << endl << endl;

cout << " Report " << endl;
cout << " ------ " << endl << endl;
cout << "Number of students: " << index <<endl<<endl;
cout << "Number of As: " << numberA << endl;
cout << "Number of Bs: " << numberB << endl;
cout << "Number of Cs: " << numberC << endl;
cout << "Number of Ds: " << numberD << endl;
cout << "Number of Fs: " << numberF << endl << endl;

sameGrades(scorePointer, index, students, testScore);

cout << endl;

}


void lastScores(int *scorePointer, int &index, const int &LENGTH, int &counter, const int &SENTINAL, int &numberA, int &numberB, int &numberC, int &numberD, int &numberF)
{
{
cout << endl << endl;
cout << " Welcome to the Student Test Score Manager! "<<endl;
cout << endl << endl;
}


int tempScore = 0;

for (index = 0; index < LENGTH; index ++)
{
cout << "Enter test score for student " << counter << " (or -999 to quit): ";
cin >> tempScore;

if (tempScore == SENTINAL || index > LENGTH)
{
break;
}

else
{
counter ++;
scorePointer[index] = tempScore;
Grades(scorePointer, index, numberA, numberB, numberC, numberD, numberF);
cout << endl;
}
}
}


void Grades(int *scorePointer, int &index, int &numberA, int &numberB, int &numberC, int &numberD, int &numberF)
{
const int div = 10;

int gradeNum;

gradeNum = scorePointer[index] / div;

switch (gradeNum)
{
case 10:
case 9:
numberA++;
break;

case 8:
numberB++;
break;

case 7:
numberC++;
break;

case 6:
numberD++;
break;

default:
numberF++;
}
}


void sameGrades(int *scorePointer, int &index, int &students, int &testScore)
{
int i;
while(testScore <= 100)
{
for(i = 0; i < index; i++)
{
if(testScore == scorePointer[i])
{
students++;
}
}
if(students >= 2)
{
cout << students << " Students have the same score: " << testScore <<endl;
students = 0;
}
students = 0;
testScore++;
}
}



Explanation / Answer

#include
#include
#include
class student // base class 1
{
private:
int rl;
char nm[20];
public:
void read();
void display();
};
class marks // base class 2
{
protected:
int s1;
int s2;
int s3;
public:
void getmarks();
void putmarks();
};
class result : public marks, public student // derived from marks and student
{
private:
int t;
float p;
char div[10];
public:
void process();
void printresult();
};
void student::read()
{
cout<<"enter Roll no and Name "< cin>>rl>>nm;

}
void student:: display()
{
cout <<"Roll NO:"<<rl<<endl;
cout<<"name : "<<nm<<endl;
}
void marks ::getmarks()
{
cout<<"enter three subject marks "<<endl;
cin>>s1>>s2>>s3;
}
void marks ::putmarks()
{
cout <<"subject 1:"<<s1<<endl;
cout<<" subject 2 : "<<s2<<endl;
cout <<"subject 3:"<<s3<<endl;
}

void result::process()
{
t= s1+s2+s3;
p = t/3.0;
p>=60?strcpy(div,"first"):p>=50?strcpy(div, "second"): strcpy(div,"third");

}

void result::printresult()
{

cout<<"total = "<<t<<endl;
cout<<"per = "<<p<<endl;
cout<<"div = "<<div<<endl;

}
void main()
{
result x;
clrscr();
x.read();
x.getmarks();
x.process();
x.display();
x.putmarks();
x.printresult();
getch();
}