Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This program is in Java In this lab you will follow the steps 1- Create a 16 X 16 matrix that represents a map of

This program is in Java

In this lab you will follow the steps 1-

  1. Create a 16 X 16 matrix that represents a map of drones. The matrix represents cells or regions of the map.
  2. 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 {}.
  3. Define the constructor for the Class Drone
  4. 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.
  5. Define the constructors for the subclass. Be sure to call the constructor of the superclass in the constructor of the subclasses.
  6. 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.
  7. Create a driver class called ControlRoom
  8. Create an array of type Drone of size 10.
  9. 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
  10. Read the file and create objects of drones and assign the drone to the array of Drone.
  11. In the driver class write a method startSearch(array of Drone, ). This method activates a search and localization process for all drones
  12. 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.
  13. 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

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions