This is the homework >> Write a program that asks the user to enter 3 test score
ID: 3654202 • Letter: T
Question
This is the homework >> Write a program that asks the user to enter 3 test scores. The program should display a letter grade for each test score, and for the average of the three scores. Write the following methods in the program: calcAverage: This void method should accept 3 test scores as arguments and print out their average. determineGrade: This void method should accept a test score as an argument and prints a letter grade for the score. I am having problems with the function calcaverage. It says that something is being used without being initialized. Here is what I have done so far. Any advice Thanks! #includeusing namespace std; //Function prototype //Return data type, followed by function name, (), and ; double calcAverage(); void determineGrade(int grade); int main() { double score1, score2, score3, average; int grade = 0; cout << "Please enter 3 grade scores you have received. Starting with the First one "<< endl; cin >> score1; determineGrade(grade); cout << "Please Enter the second grade you have received "<< endl; cin >> score2; determineGrade(grade); cout << "Please Enter the third grade you have received "<< endl; cin >> score3; determineGrade(grade); average = calcAverage( ); cout << "The average is:" << average << endl; system("PAUSE"); return 0; } //Function definition //Heading followed by body, surrounded by {} //Heading: return data type, function name, and () double calcAverage() { int score1,score2,score3,ave; ave = (score1 + score2 + score3)/3.0; return ave; } void determineGrade(int grade) { if (grade >= 90) cout << "A "; else if (grade >= 80) cout << "B "; else if (grade >= 70) cout << "C "; else if (grade >= 60) cout << "D "; else cout << "F "; }Explanation / Answer
//Function prototype //Return data type, followed by function name, (), and ; double calcAverage(); void determineGrade(int grade); int main() { double score1, score2, score3, average; int grade = 0; coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.