Answered step by step
Verified Expert Solution
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started