Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that will read race times and names from a file, display the average time and then display all of the names,

 

Write a program that will read race times and names from a file, display the average time and then display all of the names, times and how far above or below that competitor is from the average. The input from the file times.txt will be a series of times (in seconds) and last names, such as: 96 Wilson 73 Smith 88.8 Johnson 82.1 Jones 56.9 Brown There will be no more than 100 times and names. The program should print the average time. The program should then print all of the names, times and the difference of the time from the average. The output of the program should look something like this: Average time is 79.36 Wilson 96.0 16.64 Smith 73.0 -6.36 Johnson 88.8 9.44 Jones 82.1 2.74 Brown 56.9 -22.46 Your program should keep the input data in two arrays, an array of double for the times and an array of string for the names. The same index will refer to the time and name of that person. For example, time[2] would contain the time for the person whose name is in name[2]. Your program will want to count the number of values read. After reading all of the data and calculating the average, the program should print each value in the array and its difference from the mean.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java How To Program Late Objects Version

Authors: Paul Deitel, Deitel & Associates

8th Edition

0136123716, 9780136123712

More Books

Students also viewed these Programming questions

Question

Convert from radians to degrees: (a) 1 (b) /3 (c) 5/12 (d) - 3/4

Answered: 1 week ago

Question

Write code that generates n random numbers in the range 10100.

Answered: 1 week ago

Question

=+4. Draw a Venn diagram depicting two events A and

Answered: 1 week ago