Baxter Skating Rink holds a weekly ice-skating competition. Competing skaters mu
ID: 3857280 • Letter: B
Question
Baxter Skating Rink holds a weekly ice-skating competition. Competing skaters must perform a two-minute program in front of a panel of judges. The number of judges varies from week to week. At the end of a skater’s program, each judge assigns a score of 0 through 10 to the skater. Create a IPO chart and program that allows the rink manager to enter each judge’s score for a specific skater. The program should display the number of scores entered, the skater’s total score, and the skater’s average score. If necessary, create a new project named Intermediate22 Project, and save it in the Cpp8Chap07 folder. Enter the C++ instructions into a source code file named Intermediate22.cpp. Also enter appropriate comments and any additional instructions required by the compiler. Save , run, and test the program.
Explanation / Answer
Given below is the code for the question. In case of any issues , post a comment. If the answer helped, please rate it . Thank you.
#include <iostream>
using namespace std;
int main(){
int count = 0;
double score, total = 0, avg;
char ans;
do{
count ++;
cout << "Enter score for Judge " << count << ": ";
cin >> score;
total = total + score;
cout << "Do you want to enter another score (y/n)? " ;
cin >> ans;
}while(ans == 'y' || ans =='Y');
avg = total / count;
cout << endl;
cout << "Number of scores: " << count << endl;
cout << "Total of scores: " << total << endl;
cout << "Average score: " << avg << endl;
return 0;
}
output
Enter score for Judge 1: 8
Do you want to enter another score (y/n)? y
Enter score for Judge 2: 9
Do you want to enter another score (y/n)? y
Enter score for Judge 3: 9
Do you want to enter another score (y/n)? n
Number of scores: 3
Total of scores: 26
Average score: 8.66667
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.