c++ 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 Contestant 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, Contestant, contains an int variable for the contestant's ID and an array of doubles for the scores given to the contestant. Each ID 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 so that its output matches the expected outputs when testing with the same test data. First, complete everything that is required of you at the top of the file. Then complete those and only those incomplete functions according to their descriptions. Each of the incomplete functions has the following line in its body. // Write your code with comments . . . Remove that line and complete the function. Make sure your code has comment lines inserted properly like those shown in the completed functions. The main function has already been completed and should not be modified. It defines two Contestant variables, calls the readContestant function for each of the variables so that the variables are loaded with the data. If the first call returns false, issue the error message as follows, First contestant's data invalid. If the second call returns false, issue the error message as follows, Second contestant's data invalid. If both calls return true, it makes the following calls and prints the final result. Call printHeading to print the heading. Call printScores to print the first contestant's data. 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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

c++

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 Contestant 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, Contestant, contains an int variable for the contestant's ID and an array of doubles for the scores given to the contestant. Each ID 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 so that its output matches the expected outputs when testing with the same test data.

First, complete everything that is required of you at the top of the file. Then complete those and only those incomplete functions according to their descriptions. Each of the incomplete functions has the following line in its body.

// Write your code with comments . . .

Remove that line and complete the function. Make sure your code has comment lines inserted properly like those shown in the completed functions.

The main function has already been completed and should not be modified. It defines two Contestant variables, calls the readContestant function for each of the variables so that the variables are loaded with the data.

If the first call returns false, issue the error message as follows,

First contestant's data invalid.

If the second call returns false, issue the error message as follows,

Second contestant's data invalid.

If both calls return true, it makes the following calls and prints the final result.

Call printHeading to print the heading.

Call printScores to print the first contestant's data.

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
11
10.0
9.3
9.6
9.3
9.6
20
9.4
9.5
9.9
9.0
9.4
The winner of the contest between contestant 11 and contestant
20 is contestant 11.
Note that the bottom line is all in one
line.
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.
Transcribed Image Text: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 11 10.0 9.3 9.6 9.3 9.6 20 9.4 9.5 9.9 9.0 9.4 The winner of the contest between contestant 11 and contestant 20 is contestant 11. Note that the bottom line is all in one line. 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.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 8 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education