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.

7 Years
Discussion Span
Last Post by quuba

Hello danibarry.post # 1;
Good describing is 100% of succes.
You need only transcribe natural English linguage to java linguage in very simple manner.
All base things translate to java classes:
From presented text you can derive subsequently set of classes:
Flock (set of birsd- array of Bird),
Arena (default size 10x10 represented by 2dim Square array - Square[][]),
Square( one - base element of arena),
AirTrack(defined path for aircraft),
and at and base class AircraftAndBirdsSimulation where you have main control about all.
Do write!
It's more simple, then you expected.
Start work. Request from each class as you want.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.