Develop a Java application using NetBeans called ICFK 1200metersRace that will simulate a K-1 200 metres race between 2 people Your program must make use of threads to simulate the race. Create and start your threads in your main class. Your program must have a class called Athletes that implements the Runnable interface with a constructor that takes a String name which will be the athlete’s name. The Athletes class should have a run() method. This should simulate the times the athletes pass the 20-meter intervals. The run method should also allow a thread to sleep for a random interval of up to 3 seconds. After the run method has executed, the athlete’s name should be output to the screen to simulate that they have finished the race.
Develop a Java application using NetBeans called ICFK 1200metersRace that will simulate a K-1 200 metres race between 2 people Your program must make use of threads to simulate the race. Create and start your threads in your main class. Your program must have a class called Athletes that implements the Runnable interface with a constructor that takes a String name which will be the athlete’s name. The Athletes class should have a run() method. This should simulate the times the athletes pass the 20-meter intervals. The run method should also allow a thread to sleep for a random interval of up to 3 seconds. After the run method has executed, the athlete’s name should be output to the screen to simulate that they have finished the race.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps