Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The final step in the problem-solving process is to evaluate and modify (if necessary) the program. Recall that you evaluate a program by entering its

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

The final step in the problem-solving process is to evaluate and modify (if necessary) the program. Recall that you evaluate a program by entering its instructions into the computer and then using the computer to run (execute) it. While the program is running, you enter the same sample data used when desk-checking the program.

DIreCtIONS

Follow the instructions for starting your C++ development tool. Depending on the development tool you are using, you may need to create a new project; if so, name the project Lab11-2 Project and save it in the Cpp8\Chap11 folder. Enter the instructions shown in Figure 11-48 in a source file named Lab11-2.cpp. (Do not enter the line numbers.) Save the file in either the project folder or the Cpp8\Chap11 folder. Now follow the appropriate instructions for running the Lab11-2.cpp file. Test the program using the same data you used to desk-check the program. (The average and lowest times should be 14.6 and 13.1, respectively.) If necessary, correct any bugs (errors) in the program.

LAB 11-2 Plan and Create In this lab, you will plan and create an algorithm for the problem specification shown in Figure 11-46. Problem specification Chris Kaplan runs five 5K races each year. Create a program that allows him to enter his finish time for each race. The program should then display both his average and lowest times. Store the five times in a one-dimensional array named finishTimes. Use two value-returning functions named get Average and get Lowest. Pass the array and the number of elements to each function. Display the average and lowest times with one decimal place. Figure 11-46 Problem specification for Lab 11-2 Figure 11-47 shows the IPO chart information and corresponding C++ instructions. According to the figure, the main function will get the five finish times, storing each in an array element. It will then call the getAverage function to calculate and return the average time, which it will store in the avgTime variable. Next, the main function will call the getLowest function to determine the lowest time, and it will store the return value in the lowestTime variable. Finally, the main function will display the average and lowest times on the computer screen. main function C++ instructions main function IPO chart information Input finish time (5 of them) double finishTimes [5] = {0.0}; Processing Subscript (counter: 0 to 4) declared and initialized in the for clause Output average finish time Lowest finish time double avg Time = 0.0; double lowestTime = 0.0; Figure 11-47 PO chart information and C++ instructions for Lab 11-2 (continues) continued Algorithm for (int x = 0; X > finishTimes [X]: } //end for 2.call the otAverage function to calculate avgTime - getAverage (finishTimes, 5); the vad finish time pass the avay and the wonder of donets 3. call the get Lowest function to detewind lowest Time - getLowest(finishTimes, 5); the lowest finish time pass the aray and the wonder of condus cout on 7 using namespace std; 9 //function prototypes 10 double getAverage (double times [], int nunElements): 11 double get Lowest (double times ]. int numElements); 13 int main 14 double finishTimes [5] - {0.0); double avgTime - 0.0; double lowest Time -0.0; 19 /enter finish times for (int x = 0; x > finishTimes[x]: //end for } avg Time - getAverage(finishTimes, 5); lowest Time - get Lowest(finishTimes, 5): Figure 11-48 5K race program continues continued 29 30 31 cout > finishTimes [X]: } //end for 2.call the otAverage function to calculate avgTime - getAverage (finishTimes, 5); the vad finish time pass the avay and the wonder of donets 3. call the get Lowest function to detewind lowest Time - getLowest(finishTimes, 5); the lowest finish time pass the aray and the wonder of condus cout on 7 using namespace std; 9 //function prototypes 10 double getAverage (double times [], int nunElements): 11 double get Lowest (double times ]. int numElements); 13 int main 14 double finishTimes [5] - {0.0); double avgTime - 0.0; double lowest Time -0.0; 19 /enter finish times for (int x = 0; x > finishTimes[x]: //end for } avg Time - getAverage(finishTimes, 5); lowest Time - get Lowest(finishTimes, 5): Figure 11-48 5K race program continues continued 29 30 31 cout

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

Beginning C# 2005 Databases

Authors: Karli Watson

1st Edition

0470044063, 978-0470044063

More Books

Students also viewed these Databases questions