Question: #include #include using namespace std;// Constants for validating scoresconst double MIN_SCORE = 0.0;const double MAX_SCORE = 10.0;// Constants to be used for output formatting// The

#include
//*****************************************************************************//* The function named readTestScores receives a pointer parameter that points//* to a TestScores data structure to be filled with a contestant's data.//*//* It reads the contestant's ID and 4 double numbers from the keyboard and//* stores the ID in the contestant's id field and the scores in the//* 4 fields for scores.//*//* This function expects an integer and four double numbers from the keyboard.//* The implementation can use the extraction operator (>>) of cin to get//* the input from the keyboard.//*//* If the read is successful and the ID is > 0 and all scores are valid,//* the function returns true.//* Otherwise it returns false and the TestScores data structure is unchanged.//*//* Parameters//* ptr - pointer to a TestScores struct//*//* Returns//* true if successful or false otherwise.//*****************************************************************************bool readTestScores(TestScores *ptr) { bool isValid = false; // Read the description of the function above carefully and write your code // with comments . . . return isValid;}//*****************************************************************************//* Get the average score of the contestant.//*//* Parameters//* ptr - pointer to a TestScores struct//*//* Returns//* The average score.//*****************************************************************************double getAverageScore(const TestScores *ptr) { double average = 0.0; // Write your code with comments . . . return average;}//*****************************************************************************//* Verify the given test score is in the valid range between//* 0.0 and 10.0.//*//* Parameters//*//* score - The given test score.//*//* Returns//* true if the test score is valid or false otherwise.//*****************************************************************************bool isValidScore(double score) { bool isValid = true;
// Write your code with comments . . . return isValid;}//*****************************************************************************//* Compare two contestant's scores and determine the winner. The winner is//* the contestant whose average score is higher. If the average scores are//* equal, return 0.//*//* Parameters//*//* c1 - The first contestant's scores.//* c2 - The second contestant's scores.//*//* Returns//* The contestant's id who is the winner among the two contestants//* or 0.//*****************************************************************************int compareContestants(const TestScores &c1, const TestScores &c2) { int winner = 0; // Write your code with comments . . . return winner;}//*****************************************************************************//* Print the report heading.//*//* Parameters//*//* Returns//* void//*****************************************************************************void printHeading() { // Write your commented code here . . .}//*****************************************************************************//* Print the contestant's ID and test sccores.//*//* Parameters//* ptr - pointer to a TestScores struct//*//* Returns//* void//*****************************************************************************void printScores(const TestScores *ptr) { // Write your commented code here . . .}int main() { // Write your code with comments . . . return 0;}
plz help me>:
Call printScores to print the second contestant's data. Call compareContestants to determine the winner. Print the result of the contest. The output format is shown below. If the input from the keyboard is 11 10.0 9.3 9.6 9.3 20 9.4 9.5 9.9 9.0 The output must look as follows P# S1 S2 S3 S4 Average 10.0 9.3 9.6 11 20 9.3 9.0 9.6 9.4 9.4 9.5 9.9 The winner of the contest between contestant 11 and contestant 20 is contesta nt 11. If both contestants scored the same, print "Both contestants scored the same." Your code may be tested with a different set of input data. And it may be tested with invalid data to see if the error message is shown correctly
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
