Write a program to determine the winner of a race….

$25.00

Category: Tags: , , , , You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (2 votes)

Write a program to determine the winner of a race. There are several runners in every race; in addition , there are two timekeepers for each runner. One timekeeper records the time in which the runner runs the entire race; the other timekeeper records the time for each lap. All runners in every race run the same number of laps.

The first line of the data, which the user types in from the keyboard, is the number of runners. The second line of data is the number of laps in the race. The data for each runner starts with the id number of the racer, followed by the first timekeeper’s value and followed by the lap times for each lap from the second timekeeper.

Compare the time recorded by the first timekeeper to the sum of the lap times given by the second timekeeper. In addition, determine the winner of the race. To avoid confusion, the winner is determined by the first timekeeper’s time.

Sample Run

Enter the number of racers : 4

Enter the number of laps in each race : 2

Racer Id : 1111

120

60

61

Judges differ by 1

Racer Id : 2222

118

60

58

Both time keepers agree

Racer Id : 3333

121

59

65

Judges differ by 3

Racer Id : 4444

119

57

62

Both time keepers agree

The winner is racer 2222 with a time of 118