Question: Core Java_Collection_CC Problem Each Shipment will have a departure date and there might be situations during the shipment process to know the count of shipments
Core Java_Collection_CC Problem
Each Shipment will have a departure date and there might be situations during the shipment process to know the count of shipments based on the departure date. Write a program to display the count of the shipment entity details which have the given departure date. Specification : Use Collections.frequency on the ShipmentEntity with an equals method overriding on departure date. Create a Main class with main method Create a class ShipmentEntity with below private attributes,
Integer id
String name
Date departureDate
Include getter and setter method for all the attributes Include default constructor and 3 argument constructor with argument id,name,departureDate. Input and Output Format : Input consists of a String which corresponds to the shipment entity details in following order id,name,departureDate. Next input consists of a String which corresponds to the departure date to be counted. [All text in bold corresponds to input and rest corresponds to output.] Sample Input and Output : Enter the shipment entity details 1113,Edward,09-09-2017 Do you want to continue [yes/no] yes 1112,Yashini,18-11-2017 Do you want to continue [yes/no] yes 1115,Collin,18-11-2017 Do you want to continue [yes/no] no Enter the departure date to be counted 18-11-2017 Frequency : 2
Here I am providing the piece of code. Please update it and send me back.
Main.java
public class Main { public static void main(String args[]) throws IOException, ParseException{ //fill your code } }
ShipmentEntity.java
public class ShipmentEntity /*fill in blanks */ {
Integer id;
String name;
Date departureDate;
ShipmentEntity(){}
public ShipmentEntity(Integer id, String name, Date departureDate ) {
this.id = id;
this.name = name;
this.departureDate = departureDate;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public Date getDepartureDate() {
return departureDate;
}
public void setDepartureDate(Date departureDate) {
this.departureDate = departureDate;
}
public void setName(String name) {
this.name = name;
}
//fill your code
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
