Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this lab you will follow the steps 1- Create a 16 X 16 matrix that represents a map of drones. The matrix represents cells
In this lab you will follow the steps 1-
- Create a 16 X 16 matrix that represents a map of drones. The matrix represents cells or regions of the map.
- Define a class drone (with attributes ID, coordinates X and Y, and Pilot type). Define four methods MoveU(), MoveD(), MoveE(), MoveW() and leave their body empty {}.
- Define the constructor for the Class Drone
- Create two subclasses of Drone called FastDrone and SlowDrone. A SLOW drone moves by 1 increment either direction. A FAST drone moves by two increments at a time in any direction (can explore two cells in one move. Recall that the authorized moves are MoveU(), MoveD(), MoveE(), MoveW(). Overrride the move methods in each subclass.
- Define the constructors for the subclass. Be sure to call the constructor of the superclass in the constructor of the subclasses.
- Each subclass must monitor its Energy Level and return to base when the level is less or equal than half of its initial level. The energy level decreases by 1 unit for the SLOW drone and by 2 unit for the FAST drone.
- Create a driver class called ControlRoom
- Create an array of type Drone of size 10.
- Create data for 10 drones (Fast and Slow) in a data file (with the following data ID, Pilot Type of Drone, Energy level). The initial position
- Read the file and create objects of drones and assign the drone to the array of Drone.
- In the driver class write a method startSearch(array of Drone, ). This method activates a search and localization process for all drones
- The search process consists in requesting all the drones created in step 10 to search for a lost Drone with id . This method returns the X, Y positions of lost drone and the Current Energy level remaining if the drone is found. The strategy might be to divide the space by the number of drones in order to cover the whole search space with similar effort. Example of strategy. All drones will search at least 1 row/column. Some (with the most energy) will search two rows/columns.
- Create a drone of type Drone. Set a lost drone on the map (at a random location). Start the mission
Log file: log.txt
.................
Initial Position of drone 1 (X,Y)
Lost Drone position (X,Y)
Initial Energy Level drone id
Total # Moves for localizing the Drone
final position drone
Final Energy Level fd1
Failure/Success
.........
Initial Position of drone 10 (X,Y)
Lost Drone position (X,Y)
Initial Energy Level drone10
Total # Moves for localizing the Drone
final position of drone 10
Final Energy Level of drone 10
Failure/Success
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started