Question: Hi, I need a java code in a netbeans format with two classes. A main class and on another class. A delivery company has two
Hi, I need a java code in a netbeans format with two classes. A main class and on another class. 
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 etc
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
