Question: Write a program that stores the following data about a lab rat in a structure called Rat: The rats name The rats weight in ounces

Write a program that stores the following data about a lab rat in a structure called Rat: The rats name The rats weight in ounces The amount of time in seconds it took the rat to run the maze The program should keep an array of 9 of these structures. Each element is for a different rat in the lab. When the program runs, it should initialize the array using the following data: Ben, 6.5, 29 Fred, 5.8, 31 Splinter, 7.7, 33 Lima Bean, 6.5, 27 Black Bean, 5.8, 31 Pinto Bean, 7.7, 33 Skat, 6.5, 29 Big Pook, 9.8, 34 Tiger, 7.7, 33 It should then display a table that lists each rats name, weight, and time. The program should also calculate and display the average weight of all of the rats. The names and the times of the rat who ran the maze the fastest and the rat who ran the maze the slowest should also be displayed. Your program must include two functions, one to calculate the average weight and one to find the fastest and slowest rats. These functions should take an array of Rats as an argument. The first one should return the average weight, the second one should use reference parameters to return the index of the fastest and slowest rats to the caller.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!