Question
Philip, Leela, Amy, Hermes, and Hubert are training to run in a 5K sponsored by Mom's Friendly Robot Company. Each day of the week (including
Philip, Leela, Amy, Hermes, and Hubert are training to run in a 5K sponsored by Mom's Friendly Robot Company. Each day of the week (including weekends), they run some number of miles and write them down. They would like to be able to analyze this data to find the average miles run each day.
Write a program to do this analysis for them. It must contain:
- a one-dimensional array for the names of the runners
- a one-dimensional array for the days of the week
- a two-dimensional array to store the number of miles that each runner ran on each day
Your program must read miles run each day from the keyboard and store it in the two-dimensional array. It must also output the average number of miles run each day, including the day of the week.
Here's a sample run (user input in bold):
Enter the miles run by each runner in the following format: milesDay1 milesDay2 milesDay3 milesDay4 milesDay5 milesDay6 milesDay7 Miles run by Philip: 12.2 8.6 0 4.1 5.2 6.7 0 Miles run by Leela: 16.2 36.2 36.6 12.1 0 6.6 7.9 Miles run by Amy: 1.1 0.3 3.4 4.6 2.1 0 0 Miles run by Hermes: 1.2 1.4 1.6 1.7 1.8 1.9 1.4 Miles run by Hubert: 0 0 0 0 0 0 0
Average miles per day --------------------- Monday: 6.14 Tuesday: 9.3 Wednesday: 8.32 Thursday: 4.499999999999999 Friday: 1.8200000000000003 Saturday: 3.04 Sunday: 1.86
NOTE: The way you get your input does not have to match the example. You can do something similar to this if you wish:
How many miles did Philip run on Monday? 12.2 How many miles did Philip run on Tuesday? 8.6 How many miles did Philip run on Wednesday? 0
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