Question
In order to sort the shipments by weight, you will need to implement the sortShipmentsByWeight method in the Sort.java file. To implement the sortShipmentsByWeight you
In order to sort the shipments by weight, you will need to implement the sortShipmentsByWeight method in the Sort.java file. To implement the sortShipmentsByWeight you will need to implement the following two methods mergeSortShipmentsByWeight and merge method.
mergeSortShipmentsByWeight will take three arguments, an array of shipments, a start index, and an end index. This method should recursively call itself until the shipment has been sorted.
The merge method should merge two halves of the sorted shipment.
Task
Develop the sortShipmentsByWeight() method in the Sort.java file to sort cargo from heaviest to lightest.
2
The shipments now need to be distributed evenly among the vehicles. Each vehicle can do multiple transfers and can be used more than once if needed, but the weight limit of each vehicle cannot be exceeded.
The first method to implement is distributeShipmentsToVehicles which will return the maximum weight per load for each vehicle. Once the maximum capacity per vehicle has been calculated, the shipments need to be loaded onto the vehicle using the loadTheVehicles method.
Tasks
Develop the distributeShipmentsToVehicles method to evenly distribute weight between transportation vehicles but not exceed the weight limit of each vehicle. (Each vehicle can do multiple transfers/can be used more than once if needed)
2
Implement the loadTheVehicles method to load the shipments into the vehicles, the total capacity of the vehicles must be greater than the total weight of the shipment.
1
Implement the getLoadReport method in the LoadsOfVehicle.java file to generate a report.
2
Since the load reports will be read by humans and computers alike, it is important that the report format matches the sample report, including spaces.
Step by Step Solution
3.32 Rating (146 Votes )
There are 3 Steps involved in it
Step: 1
importjavautilArrayList importcomm publicclassSort param shipments param vehicles return public static LoadsOfVehicle getLoadingArrayfinal Shipment sh...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