void displayGrade(const GradedActivity &activity) { cout << setprecision(1) << fixed; cout << "The activity's numeric score is " << activity.getScore() << endl; cout << "The activity's letter grade is " << activity.getLetterGrade() << endl; }
int main() { double testScore; // to hold a test score GradedActivity test; // create object cout << "Enter your numeric test score: "; cin >> testScore; test.setScore(testScore); // stores the testscore in the test object cout << "The grade letter for the test is: " << test.getLetterGrade() << endl; return 0; }
int main() { double testScore; // To hold a test score // Create a GradedActivity object for the test. GradedActivity test; // Get a numeric test score from the user. cout << "Enter your numeric test score: "; cin >> testScore; // Store the numeric score in the test object. test.setScore(testScore); // Display the letter grade for the test. cout << "The grade for that test is " << test.getLetterGrade() << endl; return 0; }