Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a C++ program to simulate a horse race with a random seed for the horses. The output is shown at the bottom. Program Description
Write a C++ program to simulate a horse race with a random seed for the horses. The output is shown at the bottom.
Program Description In this lab you will write a C++ Console App that will simulate a horse race. Required Classes and Methods The diagram below shows the minimum class structure required for this program You can re-use classes done previously Horse Random private float distanceCovered public string name Horse(string name) void Run) int GetDistanceCovered() Console Program main() The Horse Class The constructor will initialise a new Horse object by receiving the name of this new horse as a string. The constructor will also store the new horse's name into the public variable name. The private variable distancecovered will hold the total distance currently covered by the horse. This variable is private to the horse, and cannot be accessed by any other class To access the distance covered by the horse, the public method GetDistanceCovered() should be called. This method will return the rounded distance covered as an int. Hint: Use the method int round (float number) . from the # include
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started