Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
21 views2 pages

Research

The document defines two functions - calculateQuartileGrade and calculatePercentileGrade. calculateQuartileGrade takes a student's average and returns a letter grade on a quartile scale from 1 to 3. calculatePercentileGrade takes a student's average and returns a letter grade on a percentile scale from A to F. The main function prompts the user to input grades, calculates an average, and calls the appropriate grading function based on whether the user selects quartile or percentile, outputting the grade and remarks.

Uploaded by

Gogeta Omni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views2 pages

Research

The document defines two functions - calculateQuartileGrade and calculatePercentileGrade. calculateQuartileGrade takes a student's average and returns a letter grade on a quartile scale from 1 to 3. calculatePercentileGrade takes a student's average and returns a letter grade on a percentile scale from A to F. The main function prompts the user to input grades, calculates an average, and calls the appropriate grading function based on whether the user selects quartile or percentile, outputting the grade and remarks.

Uploaded by

Gogeta Omni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

A#include <iostream>

using namespace std;

char calculateQuartileGrade(float average) {


if (average >= 98, 99 , 100) {
return '1';
} else if (average >= 95, 96 , 97) {
return '1.25';
} else if (average >= 92, 93, 94) {
return '1.50';
} else if (average >= 89, 90, 91) {
return '1.75';
} else if (average >= 86, 87, 88) {
return '2.00';
} else if (average >= 83, 84, 85) {
return '2.25';
} else if (average >= 80, 81, 82) {
return '2.50';
} else if (average >= 77, 78, 79) {
return '2.75';
} else if (average >= 73, 74, 75, 76) {
return '3.00';

} else {
return 'Failed';
}
}

// Function to calculate percentile grade


char calculatePercentileGrade(float average) {
if (average >= 98, 99 , 100) {
return 'A';
} else if (average >= 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97) {
return 'B';
} else if (average >= 75, 76, 77, 78, 79, 80, 81, 82, 83, 84) {
return 'C';
} else if (average >= 65, 66, 67, 68 ,69, 70, 71, 72, 73, 74, 75) {
return 'D';
} else {
return 'F';
}
}

int main() {
float mathGrade, englishGrade, scienceGrade;
float average;
char gradingSystem;

cout << "Enter the grade in Mathematics: ";


cin >> mathGrade;
cout << "Enter the grade in English: ";
cin >> englishGrade;
cout << "Enter the grade in Science: ";
cin >> scienceGrade;

average = (mathGrade + englishGrade + scienceGrade) / 3;


cout << "Choose the grading system (Q for Quartile, P for Percentile): ";
cin >> gradingSystem;

if (gradingSystem == 'Q' || gradingSystem == 'q') {


char quartileGrade = calculateQuartileGrade(average);
cout << "Quartile Grade: " << quartileGrade << endl;

if (quartileGrade == '1') {
cout << "Remarks: Excellent performance!" << endl;
} else if (quartileGrade == '1.25') {
cout << "Remarks:Excellent performance!" << endl;
} else if (quartileGrade == '1.50') {
cout << "Remarks: Excellent performance!" << endl;
} else if (quartileGrade == '1.75') {
cout << "Remarks: Satisfactory." << endl;
} else if (quartileGrade == '2.00') {
cout << "Remarks: Satisfactory." << endl;
} else if (quartileGrade == '2.25') {
cout << "Remarks: Good." << endl;
} else if (quartileGrade == '2.50') {
cout << "Remarks: Fair." << endl;
} else if (quartileGrade == '2.75') {
cout << "Remarks: Fair." << endl;
} else if (quartileGrade == '3.00') {
cout << "Remarks: Fair" << endl;
} else {
cout << "Remarks: Failed." << endl;
}
} else if (gradingSystem == 'P' || gradingSystem == 'p') {
char percentileGrade = calculatePercentileGrade(average);
cout << "Percentile Grade: " << percentileGrade << endl;

if (percentileGrade == 'A') {
cout << "Remarks: Excellent performance" << endl;
} else if (percentileGrade == 'B') {
cout << "Remarks: Satisfactory." << endl;
} else if (percentileGrade == 'C') {
cout << "Remarks: Good." << endl;
} else if (percentileGrade == 'D') {
cout << "Remarks: Fair" << endl;
} else if (percentileGrade == 'F') {
cout << "Remarks: Fail." << endl;

}
} else {
cout << "Invalid grading system chosen." << endl;
}

return 0;
}

You might also like