C++ Programming: From Problem Analysis to Program Design
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN: 9781337102087
Author: D. S. Malik
Publisher: Cengage Learning
Question
Book Icon
Chapter 8, Problem 12PE
Program Plan Intro

Program Plan:

  • Include the header files as per code requirement.
  • Define the function read_data() having required parameters such as an array of string to store player names, a 2D array of doubles to store miles run by each player on each day of the week and an integer is defined to store number of players or number of rows.
  • Declare and initialize required constant variables to store number of players and number of days in a week which will be number of rows and columns of the 2D array to store the number of miles run each day of a week by each player.
  • Get the player’s name and store it into the array player_Names at current index.
  • Define the function compute_average() to compute the average of miles.
  • Define the function disp_average () to display the average of miles
  • Print the player’s name from the array player_Names, total miles and average miles each day from array total_n_avg_miles.
  • Declare required arrays to store player names, number of miles run each day by each player, and total miles and average miles run each day.
  • Call the main function and call all three methods.
  • Display the output on console.

Program Description:

The main purpose of the program is to read the data from the input file and compute the total miles run by each runner and average number of miles run each day and display the names of runner along with their toal miles and average number of miles.

Blurred answer
Students have asked these similar questions
Jason, Sam, Beth, James, and Larry are preparing for an upcoming marathon. Each day of the week, they run acertain number of miles and write them into a notebook. At the end of the week, they would like to know thenumber of miles run each day, the total miles for the week, and average miles run each day. Write a program tohelp them analyze their data. Your program must contain parallel arrays: an array to store the names of therunners and a two-dimensional array of five rows and seven columns to store the number of miles run by eachrunner each day. Furthermore, your program must contain at least the following functions:a. A function to read and store the runner’s names and the numbers of miles run each day;b. A function to find the total miles run by each runner and the average number of miles run each day;c. A function to output the results. Assume that the input data is stored in a file and each line of data is in the following form:runnerName milesDay1 milesDay2 milesDay3 milesDay4…
in C++: SummaryJason, Samantha, Ravi, Sheila, and Ankit are preparing for an upcoming marathon. Each day of the week, they run a certain number of miles and write them into a notebook. At the end of the week, they would like to know the number of miles run each day and average miles run each day.InstructionsWrite a program to help them analyze their data. Your program must contain parallel arrays: an array to store the names of the runners and a two-dimensional array of five rows and seven columns to store the number of miles run by each runner each day. Furthermore, your program must contain at least the following functions: a function to read and store the runners’ names and the numbers of miles run each day; a function to calculate the average number of miles run each day; and a function to output the results. (You may assume that the input data is stored in a file and each line of data is in the following form: runnerName milesDay1 milesDay2 milesDay3 milesDay4 milesDay5 milesDay6…
Write a program to help your instructor calculate the highest and the lowest grade in the final exam of his/her CSCI250 section. Your program should ask the instructor to enter the number of students and then the grade for every student. The grades should be stored in an array. Then the program should find and display the highest and the lowest grade in the array as shown the sample run below. Sample run 1: Enter the number of Students: 5 Enter grade for student 1: 80.5 Enter grade for student 2: 35 Enter grade for student 3: 75.5 Enter grade for student 4: 90 Enter grade for student 5: 63.4 The highest grade is 90 The lowest grade is 35.0 Sample run 2: Enter the number of Students: 3 Enter grade for student 1: 80 Enter grade for student 2: 60 Enter grade for student 3: 80 The highest grade is 80 The lowest grade is 60
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT