Question: **MUST BE IN JAVA** Tortoise and the Hare Race! Operation & Specifications This application simulates a race between two runners. The runners differ in their

**MUST BE IN JAVA**

Tortoise and the Hare Race! Operation & Specifications This application simulates a race between two runners. The runners differ in their speed and how often they need to rest. One of the runners, named Tortoise, is slow but never rests. The other runner, named Hare, is ten times as fast but rests 90% of the time. There is a random element to the runners performance, so the outcome of the race is different each time the application is run. The race is run over a course of 50 meters. Each time one of the runners moves, the application displays the runners new position on the course. The first runner to reach the 50th position wins the race. When one of the runners finishes the race, the application declares that runner to be the winner and the other runner concedes. The user wll have the option to race again. You will need to create a track for each runner. Each track should be represented by an Array with the Index Variable used to represent the position of the runner. You will need a Loop. The runners will move at different speeds, so you will not know how many times the loop will repeat. You should implement a method to move the runners. The parameters you provide will determine the return value. This method will determine if the runner will move or rest. If the runner is moving the return value will represent how far they moved. You should implement a method to print out the position of each runner each time through the loop. Sample output: The race is about to start! T------------------------------------------------ H------------------------------------------------ The race is under way!! ----T-------------------------------------------- -----------H------------------------------------- Tortoise has won the Race!!! ------------------------------------------------T -------------------------------------H----------- Would you like to race again(y/n)? Hints To determine whether a runner should run or rest, calculate a random number between 1 and 100. Then have the runner rest if the number is less than or equal to the percentage of time that the runner rests. (Tortoise rests 0%, Hare rests 90%) Otherwise, the runner should run. (Tortoise runs 1 space per round, Hare can run 10 spaces per round if not resting) Printing to the screen will get messy. Use several System.out.println() to clear the screen before printing the next race update. The program will probably run very fast and be difficult to follow. Use a delay of 1 second between each print. Thread.sleep(1000); // this will stop execution for 1 second

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!