Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you help me with this code, please? It's in c++ http://cs.uky.edu/~kwjoiner/indata.txt http://cs.uky.edu/~kwjoiner/indata1.txt horse: write a class that describes the record of a race horse.

Can you help me with this code, please?

It's in c++

image text in transcribed

image text in transcribed

http://cs.uky.edu/~kwjoiner/indata.txt

http://cs.uky.edu/~kwjoiner/indata1.txt

horse: write a class that describes the record of a race horse. A horse has a name, a color, and a partial array of up to 30 race times recorded in seconds (integers). Each race time is the number of seconds it took the horse to finish a race. Use a constant for the MAX. You may assume the name and color have no spaces. Write the following methods Constructor: sets strings to empty string and numbers to zero Standard get and set methods for name and color. Standard get for number of races AddRace method that is given a race time and appends it to the list. It should print an error when unable to add the given race time Get method for a single race, that is given the index of the race in the list to retrieve. Return 0 when the given index is invalid, or return the single race time when the given index is valid A getAvgTime method that calculates and returns the average of the race times in the array. Return 0 when the number of races is 0. This average should be a double (though it is an average of integers. So race times 100 and 101 average to 100.5) stable: write a class that describes a Stable (a set of horses owned by one person/farm/group). A Stable has a stable name and a home town. (ie. "LuckyFarm" and "Lexington"), along with a partial array of up to 20 horse objects (use a constant for the MAX). You may assume there are no spaces in the stable name or hometown Write the following methods Constructor: sets strings to empty string and numbers to zero ReadFile: reads data from a text file called "indata.txt" and loads it into the data members. When the file fails to open, print a message and exit the method. There are no spaces in any names, so you do not need to use getline) at any point. The file has data for one stable, multiple horses, with multiple races for each horse, although the number of races will be the same for all horses. The file format is as follows: Line 1: stable name, hometown, number of horses, number of races for each horse For each horse: one line that contains the horse's name and color, followed by a list of race times. All horses have the same number of races (specified on line 1) and the number of horses in the stable is on line 1 Sample input file Castlebrook Lexington 4 5 SummerRain black Pokey StarOfLex bay FastFrank chestnut 137 142 173 135 153 4 horses, 5 races for each horse 149 138 155 166 144 205 222 213 199 228 158 167 189 202 168 white Hint: o Read stable name, hometown, number of horses, number of races o For each horse Read horse name and color Set these in the next available horse object For each race time " Read it

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_2

Step: 3

blur-text-image_3

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 VB.NET Databases

Authors: Thearon Willis

1st Edition

1594864217, 978-1594864216

More Books

Students also viewed these Databases questions

Question

Explain the challenges to HRM practices of a firm.

Answered: 1 week ago

Question

3. An overview of the key behaviors is presented.

Answered: 1 week ago

Question

2. The model is credible to the trainees.

Answered: 1 week ago