Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / Customers might want their shipments to be delivered very urgently,in which case the priority of shipments comes into role

Customers might want their shipments to be delivered very urgently,in which case the priority of shipments comes into role

Computer Science

Customers might want their shipments to be delivered very urgently,in which case the priority of shipments comes into role. For those kinds of emergency shipments, the shipment detail will have an additional attribute to say if it is a priority shipment or not. While unloading the containers, the priority shipments are to be sent out first than the other. Writ a program using the concept of priority queue to display a list which depicts the order in which shipments are sent out if there are priority shipments.Creat a class Shipment with the following private member variables/attributes. 
String name 
String arrivalPort 
String departurePort 
Integer priority
Include a default constructor and 4-argument constructor with following argument order name, arrivalPort, departurePort, priority
Include appropriate getters and setters. Override compareTo method by implementing Comparable interface.
Creat a class Main to test above classes.  
 Problem Specification: ---------------------------------------------------------------------------------------------------------
Creat 2 classes Main and Shipment to test this
Please note the o/pt must be sorted like the below example
Sample Input and Output - Example 1 Enter the shipment detail: 
AGCI,India,America,no 
Do you want to add another shipment?(yes/no) 
yes 
Enter the shipment detail: 
DLX Services,America,England,no 
Do you want to add another shipment?(yes/no) 
yes 
Enter the shipment detail: 
Fedex Org,Australia,America,yes 
Do you want to add another shipment?(yes/no) 
no 
Name        Arrivalport   Departureport    Express delivery 
Fedex Org     Australia    America      Yes 
AGCI        India      America      No
DLX Services    America     England      No
Sample Input and Output - Example 2
Enter the shipment detail: 
Fedex Org,India,America,no
Do you want to add another shipment?(yes/no) 
Yes
Enter the shipment detail: 
AGSG Shipments,Australia,America,yes
Do you want to add another shipment?(yes/no) 
Yes
Enter the shipment detail: 
AGSG,England,America,yes
Do you want to add another shipment?(yes/no) 
No Name      Arrivalport  Departureport Express delivery
AGSG Shipments Australia   America    Yes
AGSG      England    America    Yes
Fedex Org   India     America    No
---------------------------------------------------------------------------------------------------------
Shipment details are entered as a comma separated values in order name,arrivalPort,departurePort,isExpress. 
If the shipment is express delivery then set priority to 1 or 2. 
Use System.out.println(String.format("%-15s%-15s%-15s%s","Name","Arrivalport","Departureport","Express in Main to display the Output.delivery"))
Input and Output Format: 
Refer sample input and output for formatting specifications. 

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE