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, xy position, and effective signal range as arguments
Methods
signalDroneString int
Send a message to a drone with a certain ID in range.
signalDeployDroneDepot
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 to run the driver.
The driver runs a simple simulation for time steps:
Creates a DroneController object with a maximum number of drones at position with a signal range of
Creates a DroneDepot object at position
Each Drone in the system is ordered to move randomly along the X or Y axis
The DroneController scans for drones which are still within signal range
The DroneController randomly signals the DroneDepot to deploy another drone OR signals a random Drone in range with the message MSG
The state of the system is printed to the console ie Each drone's IDxy 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
