Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hi, I need help with this question. It needs to be done in JAVA A delivery company has two vehicles to serve an area covered
Hi, I need help with this question. It needs to be done in JAVA
A delivery company has two vehicles to serve an area covered by a grid of roads stretching from north to south and from east to west every kilometer. At the beginning of the day both vehicles start from position (0,0). When a vehicle receives a set of coordinates for delivery, it moves along the X and Y axis until it reaches the correct position and stays there awaiting a new set of coordinates for new delivery. The company has a dispatcher that chooses the closest between the two vehicles for the next delivery. Upon receiving a new delivery destination, the dispatcher prompts both vehicles for their respective distances from the required destination and assigns the delivery to the vehicle with the shortest distance. The distance is calculated as destination X-current X+ destination Y-current Y Create a Vehicle class for keeping current set of coordinates and calculating the distance to new destination. The main class will have two vehicle objects, scan 5 sets of coordinates for 5 different deliveries and print which vehicle is chosen for it in the following format: x1 y1 vehicle number n x2 y 2 vehicle number m etcStep 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