Skip to main content

Posts

Showing posts with the label OOP

The Race Java Multi-Threading project with complete source code

The Race A number of racers will compete in a race with three obstacles: The Forest, The Mountain and The River. Before the first obstacle and between any two obstacles, the racers will stop for rest and food (by sleeping for a random time). The sequence of events will be something similar to: Rest Forest Rest Mountain Rest River Get Home Note: you will need to keep track of the time when a racer started a specific obstacle and when it ended that obstacle, together with the time when the racer started the race until he finished the race. The obstacles are described below: The Forest: You will have to use the setPriority( ), getPriority( ) and yield( ) methods. At the entry to the forest, the racer will try to rush as much as possible (simulated by increasing its current priority by a randomly generated number between 0-4). The racer using a compass will have to find in the forest a map that contains a magic word. The forest will be a file of more than 300 but les...