COMPUTE GRADE PROGRAM
Create a function named StudeInfo that will accept the following values from the user:
StudentID, StudentName, Course, Age, PrelimGrade, MidtermGrade, FinalTermGrade.
Create a function named ComputeGrade that will compute Final Average which is computed as the sum of PrelimGrade, MidtermGrade and FinalTermGrade divided by 3.
Display the output with the following format: (sample output)
*************************************************************************************
Student ID : 00-00-01
Student Name : FERNAN W. AMMAQUI
____________________________________________________________________________________
PRELIM GRADE : 90.0
MIDTERM GRADE : 90.0
FINAL GRADE : 90.0
AVERAGE : 90.0
*************************************************************************************
Color the Student ID and Name values with green. Failing average will be colored with red. Otherwise, color it with blue.
Here is my program:
void StudeInfo(string StudentID, string StudentName, int Course, int Age, double PrelimGrade, double MidtermGrade, double FinalTermGrade)
{
cout << "Student id - " << StudentID << endl;
cout << "Student name:" << StudentName << endl;
cout << "Course: " << Course << endl;
cout << "Age: " << Age << endl;
cout << "Prelim grade: " << PrelimGrade << endl;
cout << "Midterm grade: " << MidtermGrade << endl;
cout << "Final grade: " << FinalTermGrade << endl;
}
void ComputeGrade(double PrelimGrade, double MidetermGrade, double FinalTermGrade)
{
cout << "AVERAGE: " << (PrelimGrade + MidetermGrade + FinalTermGrade) / 3 << endl;
}
int main()
{
string id = "00-00-1";
string sname = "James K";
int course = 3;
int age = 18;
double pgrade = 90.0;
double mgrade = 56.0;
double fgrade = 45.3;
StudeInfo(id, sname,course,age,pgrade,mgrade,fgrade);
ComputeGrade(pgrade,mgrade,fgrade);
}
Comments
Leave a comment