Question: Create a DroneController class with: Fields Array of Drones, all drones in system Array of Drones, all drones in range Maximum number of drones Current

Create a DroneController class with:
Fields
Array of Drones, all drones in system
Array of Drones, all drones in range
Maximum number of drones
Current number of active drones
x and y position
Effective signal range
Constructor
Takes maximum number of drones, x,y position, and effective signal range as arguments
Methods
signalDrone(String, int)
Send a message to a drone with a certain ID in range.
signalDeploy(DroneDepot)
Signal DroneDepot to deploy a Drone and add it to system, only if the current maximum has not been reached.
scanRange()
Determine which drones are in range.
Use the provided Driver class to test your implementation. You will need to include your previous implementation of Drone and DroneDepot classes (from Lab 2) to run the driver.
The driver runs a simple simulation for 20 time steps:
1. Creates a DroneController object with a maximum number of drones at position (0,0) with a signal range of 10
2. Creates a DroneDepot object at position (5,5)
3. Each Drone in the system is ordered to move randomly along the X or Y axis
4. The DroneController scans for drones which are still within signal range
5. The DroneController randomly signals the DroneDepot to deploy another drone OR signals a random Drone in range with the message MSG
6. The state of the system is printed to the console i.e.. Each drone's ID,(x,y) position, message, and whether it is in range of the DroneController
This program takes input as an argument passed to the main method. You can set the value that is given at the beginning of the program by navigating to Run -> Run Configurations and entering a number in the program arguments box in the Arguments tab.

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!