The Problem: Aircraft fly from one point to another. At the same time, birds fly around. The objective is to determine whether the aircraft will encounter birds or be able to reach its destination safely. The airspace is divided into 100 squares (10 x 10 squares). For simplicity, we shall assume 2-dimensional space.
Task 1
The airspace is occupied by one aircraft and a number of birds. Initially, the aircraft is placed in the square corresponding to its starting point. The aircraft starts in square (0,0) and has a destination of square (9,9) (numbering from 0). Initially, the birds are placed randomly in one square each. A square can contain more than one bird.
Aircraft - In each time period:
• The aircraft moves from one square to the next on direct path to the destination. The program must handle any route.
• If the aircraft encounters a bird, one engine fails and the aircraft continues
• If the aircraft encounters two or more birds, both engine fails and the aircraft crashes into the sea
Birds - In each time period:
• Birds moves from one square to an adjacent square chosen randomly but not staying in the same square. Multiple birds can choose the same square to fly into. Adjacent squares includes diagonally adjacent.
• If a bird encounters an aircraft in the square it moves into, it is killed.
Note that both the aircraft and birds move simultaneously. Write a multithreaded Java program to model the aircraft and birds. There is to be one thread for the aircraft and one thread for each bird.
Program Output: The program should display the progress of the aircraft and birds. At the very least, print out an 10 x 10 array with symbols for aircraft and birds after each iteration. Extra credit for graphical output.