Make a program that will compute the prelim, midterm, final grades of the students. The program will input grades for quiz, recitation, project, and exam rating. The class standing, the class average and the prelim, midterm and final grades will be computed and displayed automatically. Display also the grade equivalent and if the grade of the student is greater than 75 then the remark will be “Passed” otherwise “Failed” Use any selection and repetition structures. Use these formulas:
PRELIM:
CS = (Q + R) / 2
PROJECT = P* 40%
LECTURE = ((2 * CS + ER) / 3) * 60%
PG = PROJECT + LECTURE
MIDTERM:
CSM = (QM + RM) / 2
MPROJECT = PM * 40%
MLECTURE = (2*CSM + MER) / 3 * 60%
CAM = MPROJECT + MLECTURE
MG = (2 * CAM + PG) / 3
FINALS:
CSF = (QF + RF) / 2
FPROJECT = PF * 40%
FLECTURE = ((2 * CSF + PER) / 3 * 60%
CAF = FPROJECT + FLECTURE
FG = (2*CAF+MG) / 3
#include<iostream>
using namespace std;
int main(){
int numberStudents=-1;
float classStanding;
float classAverage;
while(numberStudents<=0 || numberStudents>100){
cout<<"Enter the number for the students: ";
cin>>numberStudents;
}
for(int i=0;i<numberStudents;i++){
float Q=-1;//quiz variable for PRELIM
float R=-1;//recitation for PRELIM
float P=-1;//project for PRELIM
float ER=-1;//exam rating for PRELIM
float QM=-1;//quiz variable for MIDTERM
float RM=-1;//recitation for MIDTERM
float PM=-1;//project for MIDTERM
float MER=-1;//exam rating for MIDTERM
float QF=-1;//quiz variable for FINALS
float RF=-1;//recitation for FINALS
float PF=-1;//project for FINALS
float PER=-1;//exam rating for FINALS
//input grades for PRELIM quiz, recitation, project, and exam rating.
while(Q<0 || Q>100){
cout<<"Enter the grade for the prelim quiz for the student "<<(i+1)<<": ";
cin>>Q;
}
while(R<0 || R>100){
cout<<"Enter the grade for the prelim recitation for the student "<<(i+1)<<": ";
cin>>R;
}
while(P<0 || P>100){
cout<<"Enter the grade for the prelim project for the student "<<(i+1)<<": ";
cin>>P;
}
while(ER<0 || ER>100){
cout<<"Enter the grade for the prelim exam rating for the student "<<(i+1)<<": ";
cin>>ER;
}
cout<<"\n";
//input grades for MIDTERM quiz, recitation, project, and exam rating.
while(QM<0 || QM>100){
cout<<"Enter the grade for the midterm quiz for the student "<<(i+1)<<": ";
cin>>QM;
}
while(RM<0 || RM>100){
cout<<"Enter the grade for the midterm recitation for the student "<<(i+1)<<": ";
cin>>RM;
}
while(PM<0 || PM>100){
cout<<"Enter the grade for the midterm project for the student "<<(i+1)<<": ";
cin>>PM;
}
while(MER<0 || MER>100){
cout<<"Enter the grade for the midterm exam rating for the student "<<(i+1)<<": ";
cin>>MER;
}
cout<<"\n";
//input grades for final quiz, recitation, project, and exam rating.
while(QF<0 || QF>100){
cout<<"Enter the grade for the final quiz for the student "<<(i+1)<<": ";
cin>>QF;
}
while(RF<0 || RF>100){
cout<<"Enter the grade for the final recitation for the student "<<(i+1)<<": ";
cin>>RF;
}
while(PF<0 || PF>100){
cout<<"Enter the grade for the final project for the student "<<(i+1)<<": ";
cin>>PF;
}
while(PER<0 || PER>100){
cout<<"Enter the grade for the final exam rating for the student "<<(i+1)<<": ";
cin>>PER;
}
//compute the prelim, midterm, final grades of the students
//PRELIM:
//CS = (Q + R) / 2
float CS = (Q + R) / 2;
//PROJECT = P* 40%
float PROJECT = P*0.40;
//LECTURE = ((2 * CS + ER) / 3) * 60%
float LECTURE = ((2 * CS + ER) / 3) * 0.6;
//PG = PROJECT + LECTURE
float PG = PROJECT + LECTURE;
//MIDTERM:
//CSM = (QM + RM) / 2
float CSM = (QM + RM) / 2;
//MPROJECT = PM * 40%
float MPROJECT = PM * 0.40;
//MLECTURE = (2*CSM + MER) / 3 * 60%
float MLECTURE = ((2*CSM + MER) / 3) * 0.60;
//CAM = MPROJECT + MLECTURE
float CAM = MPROJECT + MLECTURE;
//MG = (2 * CAM + PG) / 3
float MG = (2 * CAM + PG) / 3;
//FINALS:
//CSF = (QF + RF) / 2
float CSF = (QF + RF) / 2;
//FPROJECT = PF * 40%
float FPROJECT = PF * 0.40;
//FLECTURE = ((2 * CSF + PER) / 3 * 60%
float FLECTURE = ((2 * CSF + PER) / 3) * 0.60;
//CAF = FPROJECT + FLECTURE
float CAF = FPROJECT + FLECTURE;
//FG = (2*CAF+MG) / 3
float FG = (2*CAF+MG) / 3;
//The class standing, the class average and the prelim, midterm and final grades will be computed and displayed automatically.
cout<<"\nPRELIM:\n";
cout<<"The class standing: "<<(int)CS<<"\n";
cout<<"The class class average: "<<(int)LECTURE<<"\n";
cout<<"The prelim: "<<(int)PG<<"\n";
cout<<"\nMIDTERM:\n";
cout<<"The class standing: "<<(int)CSM<<"\n";
cout<<"The class class average: "<<(int)MLECTURE<<"\n";
cout<<"The midterm: "<<(int)MG<<"\n";
cout<<"\nFINALS:\n";
cout<<"The class standing: "<<(int)CSF<<"\n";
cout<<"The class class average: "<<(int)FLECTURE<<"\n";
cout<<"The final grade: "<<(int)FG<<"\n";
float gradeEquivalent=(PG+MG+FG)/3;
cout<<"\nThe grade equivalent: "<<(int)gradeEquivalent<<"\n";
//Display the grade equivalent and if the grade of the student is greater than 75 then the remark will be "Passed" otherwise "Failed"
if((int)gradeEquivalent>=75){
cout<<"Passed\n";
}else{
cout<<"Failed\n";
}
}
system("pause");
return 0;
}
Comments
Leave a comment