Skip to content

Commit

Permalink
add date_added field to Luggage
Browse files Browse the repository at this point in the history
  • Loading branch information
LeanKhan committed Feb 7, 2021
1 parent e511c76 commit 622a3e5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions SocketServer/src/Luggage.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ public class Luggage {
private String flight;
private String weight;
private int bags;
private String date_added;
private Owner owner;

Luggage() {
Expand Down Expand Up @@ -40,6 +41,14 @@ public int getBags() {
return bags;
}

public void setDateAdded(String dateAdded) {
this.date_added = dateAdded;
}

public String getDate_added() {
return date_added;
}

public void setOwner(Owner owner) {
this.owner = owner;
}
Expand All @@ -62,6 +71,8 @@ public String toString() {

sb.append("Number of Bags: " + getBags() + "\n");

sb.append("Date Added: " + getDate_added() + "\n");

sb.append("Owner: " + getOwner() + "\n");

sb.append("--------------------------");
Expand Down
3 changes: 3 additions & 0 deletions SocketServer/src/LuggageSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.LocalDateTime;
import java.util.ArrayList;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.core.JsonGenerationException;
Expand Down Expand Up @@ -170,6 +171,8 @@ public Boolean checkinLuggage(String luggageJSON) {

l.setId(index);

l.setDateAdded(LocalDateTime.now().toString());

System.out.println("Luggage added successfully! => ");

added = LuggageSystem.luggages.add(l);
Expand Down

0 comments on commit 622a3e5

Please sign in to comment.