Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in java An online retailer has robots that collect items from different locations in a warehouse to fulfill customer orders. Given a set of items

in java

An online retailer has robots that collect items from different locations in a warehouse to fulfill customer orders. Given a set of items and their locations, a robot starts from a packing station, collects all the items, and returns to the packing station quickly. How would you design an algorithm that finds the shortest route? The goal of the assignment is to find the shortest route for the robot. Desgin a brute-force algorithm that recursively enumerates all possible routes and determines the shortest route. For simplicity, we use non-negative integer x,y coordinates for the locations and assume a robot can travel from one location to another via a straight line (ie, no stationary or moving obstacles). Sample input and output are on the course website. We will evaluate your submission on code01.fit.edu, so you are strongly recommended to ensure your program functions properly on code01.fit.edu. To preserve invisible characters, we strongly recommend you to download, NOT copy and paste, input data files. (For C, to include the math library, append -lm at the end of gcc.) Input: The command-line argument for HW2.java (hw2.c) is the name of the input file, which has: 1. the number of locations on the first line 2. a location name, x coordinate, and y coordinate on each of the remaining lines Output: The program prints the shortest route (from a packing station and back to the packing station) to the standard output (screen). The location name, x, y, and distance from the previous location is on a line and the total distance is on the last line. All distance values have 2 decimal places. The first and last locations are the packing station, and the first location has a distance value of 0.00 from the previous location. If more than one route has the smallest distance, output the route that is alphabetically earlier. For example, P, A, B, C, P would be earlier than P, C, B, A, P

Sample Input:

4 PackingStation 10 10 Books 15 4 Electronics 5 5 SportsEquipment 3 20

Sample Output:

PackingStation 10 10 0.00 Books 15 4 7.81 Electronics 5 5 10.05 SportsEquipment 3 20 15.13 PackingStation 10 10 12.21 Total Distance: 45.20

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

More Books

Students also viewed these Databases questions

Question

21. Solving Our Networking Problems With an Extranet

Answered: 1 week ago