Package.java (947B)
1 package collections; 2 3 /* 4 // This class is used to hold the parameters of each package 5 // Each package is then contained inside a stack or "bag". 6 */ 7 8 public class Package { 9 private String name; 10 private double weight; 11 private int number; 12 private String sender; 13 private String recipient; 14 15 public Package(String name, double weight, int number, String sender, String recipient) { 16 this.name = name; 17 this.weight = weight; 18 this.number = number; 19 this.sender = sender; 20 this.recipient = recipient; 21 } 22 23 public String getName() { 24 return name; 25 } 26 27 public double getWeight() { 28 return this.weight; 29 } 30 31 public int getNumber() { 32 return number; 33 } 34 35 public String getSender() { 36 return sender; 37 } 38 39 public String getRecipient() { 40 return recipient; 41 } 42 43 @Override 44 public String toString() { 45 return name; 46 } 47 }