Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Programming: Overview: This project is for testing the introduction of classes and dynamic allocation of arrays of classes. In this assignment, you will be

C++ Programming:
image text in transcribed
image text in transcribed
image text in transcribed
Overview: This project is for testing the introduction of classes and dynamic allocation of arrays of classes. In this assignment, you will be performing a horse racing simulation. To start with, you will write a Horse class. The Horse class should have the following member variables: private name: A string holding the horses nane private rider: A string holding the rider's name. private maxRunningDistPerSecond: An int that holds the maximum distance the horse could run in one second private distanceTraveled: How far the horse has gone already. private racesWon: An int that determines how nuch races this horse and rider have won In addition, the class should have the following constructors and member functions: Constructor: This constructor should accept the horse's name and rider as arguments. It should initialize each horse to a random maxRunningDistPerSecond(1-100). Distance Traveled should be set to 0 Accessors and mutators: Appropriate accessor and mutator functions should be used as required by the following methods: runASecond: A method that adds to distanceTraveled an amount from 0-maxRunningDistPerSecond. This is the method that moves this horse along sendToGate: Reset the horse to the start of a race by setting distance Traveled to 0 displayHorse(int goalLength): This method should attempt to draw where the horse is along its race. Should try to graphically display in ascii how far the horse has gone on its way to goalLength. This should be scaled so it doesn't overrun the screen. Some examples: I Pharaoh, ridden by Mark Secretariat, ridden by George Calamity Jane, ridden by Mary So if a horse has "distance Traveled" of 50 and the goalLength passed is 100, then the>for the horse should be halfway towards the "goal". If it is called where the distance Traveled is greater than the goalLength (indicating it has finished), this output would be I.Johrn

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions