Question: Need help with this java problem. Please as simple as possibe. Project 18-1: Tortoise and the hare race (cont.) Specifications . The main method of

Need help with this java problem. Please as simple as possibe.

Need help with this java problem. Please as simple as possibe. Project

18-1: Tortoise and the hare race (cont.) Specifications . The main method

Project 18-1: Tortoise and the hare race (cont.) Specifications . The main method of the application's main class should create two runner threads and start them. One of the threads should be named "Tortoise." It runs only 10 meters each move, but plods along without ever resting. The other thread should be named "Hare." It should run 100 meters each move, but should rest 90% of the time. . Each runner should be a separate thread created from the class named RunnerThread This class should include four variables . a string representing the name of the runner . an int value from 1 to 100 indicating the likelihood that on any given move the runner will rest instead of run an int value that indicates the runners speed-that is, how many meters the runner travels in each move an int value indicating the runner's progress on the course . The run method of the RunnerThread class should consist of a loop that repeats until the runner has reached 300 meters. Each time through the loop, the thread should decide whether it should run or rest based on a random number and the percentage passed to the constructor. If this random number indicates that the runner should run, the class should add the speed value for the runner. The run method should sleep for 300 milliseconds on each repetition of the loop Hint . 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. Otherw ise, the runner should run

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!