Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Database Processing Fundamentals Design And Implementation

Authors: KROENKE DAVID M.

1st Edition

8120322258, 978-8120322257

More Books

Students also viewed these Databases questions

Question

The same, but move over 4 and up 2. P-698

Answered: 1 week ago