Question: IN JAVA: Q6. (Simulation: The Tortoise and the Hare) (20 points) In this problem, you'll re-create the classic race of the tortoise and the hare.

IN JAVA:

IN JAVA: Q6. (Simulation: The Tortoise and the Hare) (20 points) In

Q6. (Simulation: The Tortoise and the Hare) (20 points) In this problem, you'll re-create the classic race of the tortoise and the hare. You'll use random-number generation to develop a simulation of this memorable event. Our contenders begin the race at square of 70 squares. Each square represents a possible position along the race course. The finish line is at square 70. The first contender to reach or pass square 70 is rewarded with a pail of fresh carrots and lettuce. The course weaves its way up the side of a slippery mountain, so occasionally the contenders lose ground. A clock ticks once per second. With each tick of the clock, your application should adjust the position of the animals according to the rules in Fig. Use variables to keep track of the positions of the animals (i.e., position numbers are 1-70). Start each animal at position 1 (the "starting gate"). If an animal slips left before square 1, move it back to square 1 Animal Move type Percentage of the time Actual move Tortoise Fast plod 50% 3 squares to the right 6 squares to the left I square to the right No move at all 9 squares to the right 1 Slip Slowplod Big hop Big slip Small hop Small slip 30% 20% 20% 1096 30% 20% 2 squares to the left 1 square to the right 2 squares to the left Generate the percentages in Fig by producing a random integer i in the range 1 si 10, For the tortoise, perform a "fast plod" when 1 i

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!