Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q 1 . ( 1 0 marks ) Write a program that uses a class called Data, in Data.cpp . Your program first asks a

Q1.(10 marks) Write a program that uses a class called Data, in Data.cpp. Your program first asks a runner for a distance and 5 of his/her best times in that event, and it will store the times in the array time. Then it finds the best, the worst, and the average time for that runner. Finally, it displays all five times, following by the worst, the best, and the average. The class Data has the following attributes, including an array of time, distance, min, max, and average. double time[N]; //array of times in second int distance; //distance in meter double min, max, average; You need to write the function statistics. Please note that we assume we are only dealing with N times (N is equal or greater than 5). So the statistics function is a simple function. This program finds the fastest time as the best time, the slowest time as the worst time, and computes the average of N times. Other functions including setTime(), setDistance(), and display() function to output the statistics functions results.

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

Guide To Client Server Databases

Authors: Joe Salemi

2nd Edition

1562763105, 978-1562763107

More Books

Students also viewed these Databases questions

Question

2. What do you believe is at the root of the problem?

Answered: 1 week ago