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

The program reads data about two contestants from the keyboard and displays the scores and the winner of the two contestants. The program uses a data structure called TestScores for storing the scores of a contestant and a set of functions related to the data structure for processing the scores of contestants. The data structure, TestScores, contains an int variable for the contestant's ID and 4 double fields for the scores given to the contestant. Each must be a positive integer. Each score must fall in the range from 0.0 to 10.0 inclusive Your job is to complete the program according to the following description and the description of each function in the source file. First, complete everything that is required of you at the top of the film. Then complete the code for all the related functions and the main function Below are description of the related functions: The function named readTestScores receives a pointer parameter that points to a TestScores data structure to be filled with a contestant's data. The function reads the contestant's ID and 4 double numbers from the keyboard and stores the ip in the id tield and the scores in the fields for scores. If the read is successful and all values are valid, the function returns true. Otherwiselt returns folse. The function named getID receives a pointer parametar that points to a TestScores data structure that represents a contestant's doto. It returns the of the contestant. The function named getAverageScore receives a pointer parameter that points to a Testscores dota structure that represents a contestant's data. It returns the average of the contestants scores The function named printHeading. It prints the heading of the report according the the format show at the bottom. You must use the formatting constants defined in the source file to format the heading The function named prints.cores receiven a pointer parameter that points to a TestScores data structure that represents a contestants data. It displays the ID, the scores of the contestant and the average occording to the format shown at the bottom. You must use the formatting constants defined in the source file to format the ID and the other values. The function named lavaldScore receives ascenIt checks to see if the score is valid and returns a bool value. A valid score is between 0,0 and 10.0 mclusive. This function can be called whenever test scores are stored in a TestScores object. You must use the constants defined in the source file for the minimum ond maximum scores The function named compareContestants receives two parameters each represents a contestant's dato. I determines the winner and returns the winner's 10 of those two contestants. Test the data structure and the related functions by writing code in a main function as follows in the main function, detine two Testscores variables. call the rood Toetscores function for each of the verboties so that the variables are loaded with the data, if the first call returns fole, on the error message as follows First contestant's dota invold. If the second coll return false, lue the error message as follows Second contestant's doto invalid. both calls return true, make the following calls and print the final result, Col printheading to print the heading CollprintScores to print the first contestant's data Col printScores to print the second contestant's data Cal compareContestants to determine the winner. Print the result of the contest 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. The output format is shown below. 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 S2 P# S1 S3 S4 Average 11 20 10.0 9.4 9.3 9.5 9.6 9.9 9.3 9.0 9.6 9.4 The winner of the contest between contestant 11 and contestant 20 is contestant 11
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
