Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Complete the following program by defining the function statistics(). The function statistics() finds and prints the fastest time as the best time, the slowest time

Complete the following program by defining the function statistics(). The function statistics() finds and prints the fastest time as the best time, the slowest time as the worst time, and computes the average of 5 times for each event. After this is completed, write a driver that uses the class. Your driver first asks a runner for a distance and 5 of his/her best times in that event, and it stores the times in the array time. Then it prints the best time, the worst time, and the average time for that runner. Finally, on a different line the driver displays the complete array of times.

class RunnerData { public: void set_distance(int d); void set_times(int i, double t); void display(); void statistics( ); private: double time[5]; //array of time in second int distance; //distance in meter double min, max, average; }; The member functions are defined as: void RunnerData::set_distance(int d) { distance = d; } void RunnerData::set_times(int i, double t) { time[i] = t; } void RunnerData::display() { cout << "Here is your best 5 times for "; cout << distance << " meter "; for(int i = 0; i < 5; i++) { cout << time[i] << endl; } }

Thanks in advance :)

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

Oracle 10g Database Administrator Implementation And Administration

Authors: Gavin Powell, Carol McCullough Dieter

2nd Edition

1418836656, 9781418836658

More Books

Students also viewed these Databases questions