Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
579
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.37 KB | None | 0 0
  1. package a2ztransit;
  2.  
  3.  
  4. public class Package {
  5.  
  6. // member data
  7. private int packageID;
  8. private String arrivalTime;
  9. private String name;
  10. private String address;
  11. private String city;
  12. private String county;
  13. private String contactNumber;
  14. private String description;
  15. private double price;
  16. private boolean prePaid;
  17.  
  18. // constructor
  19. public Package(int packageID, String arrivalTime) {
  20. setPackage("", "", "", "", "", "", "", 0.0, false);
  21. this.packageID = packageID;
  22. this.arrivalTime = arrivalTime;
  23. }
  24.  
  25.  
  26.  
  27. // set the package properties
  28. void setPackage(String name, String address,
  29. String city, String county, String contactNumber,
  30. String arrivalTime, String description, double price, boolean prePaid) {
  31. this.setName(name);
  32. this.setAddress(address);
  33. this.setCity(city);
  34. this.setCounty(county);
  35. this.setContactNumber(contactNumber);
  36. this.setArrivalTime(arrivalTime);
  37. this.setPrice(price);
  38. this.setDescription(description);
  39. this.setPrePaid(prePaid);
  40.  
  41. }
  42.  
  43. /**
  44. * @return the name
  45. */
  46. public String getName() {
  47. return name;
  48. }
  49.  
  50. /**
  51. * @param name the name to set
  52. */
  53. public void setName(String name) {
  54. this.name = name;
  55. }
  56.  
  57. /**
  58. * @return the address
  59. */
  60. public String getAddress() {
  61. return address;
  62. }
  63.  
  64. /**
  65. * @param address the address to set
  66. */
  67. public void setAddress(String address) {
  68. this.address = address;
  69. }
  70.  
  71. /**
  72. * @return the city
  73. */
  74. public String getCity() {
  75. return city;
  76. }
  77.  
  78. /**
  79. * @param city the city to set
  80. */
  81. public void setCity(String city) {
  82. this.city = city;
  83. }
  84.  
  85. /**
  86. * @return the county
  87. */
  88. public String getCounty() {
  89. return county;
  90. }
  91.  
  92. /**
  93. * @param county the county to set
  94. */
  95. public void setCounty(String county) {
  96. this.county = county;
  97. }
  98.  
  99. /**
  100. * @return the arrivalTime
  101. */
  102. public String getArrivalTime() {
  103. return arrivalTime;
  104. }
  105.  
  106. /**
  107. * @param arrivalTime the arrivalTime to set
  108. */
  109. public void setArrivalTime(String arrivalTime) {
  110. this.arrivalTime = arrivalTime;
  111. }
  112.  
  113. /**
  114. * @return the contactNumber
  115. */
  116. public String getContactNumber() {
  117. return contactNumber;
  118. }
  119.  
  120. /**
  121. * @param contactNumber the contactNumber to set
  122. */
  123. public void setContactNumber(String contactNumber) {
  124. this.contactNumber = contactNumber;
  125. }
  126.  
  127. /**
  128. * @return the parcelID
  129. */
  130. public int getPackageID() {
  131. return packageID;
  132. }
  133.  
  134. /**
  135. * @param parcelID the parcelID to set
  136. */
  137. public void setParcelID(int packageID) {
  138. this.packageID = packageID;
  139. }
  140.  
  141. /**
  142. * @return the price
  143. */
  144. public double getPrice() {
  145. return price;
  146. }
  147.  
  148. /**
  149. * @param price the price to set
  150. */
  151. public void setPrice(double price) {
  152. this.price = price;
  153. }
  154.  
  155. /**
  156. * @return the prePaid
  157. */
  158. public boolean isPrePaid() {
  159. return prePaid;
  160. }
  161.  
  162. /**
  163. * @param prePaid the prePaid to set
  164. */
  165. public void setPrePaid(boolean prePaid) {
  166. this.prePaid = prePaid;
  167. }
  168.  
  169. /**
  170. * @return the description
  171. */
  172. public String getDescription() {
  173. return description;
  174. }
  175.  
  176. /**
  177. * @param description the description to set
  178. */
  179. public void setDescription(String description) {
  180. this.description = description;
  181. }
  182.  
  183. @Override
  184. public String toString() {
  185.  
  186. return "Package ID: " + this.getPackageID()
  187. + "\nPackage Arrived at: " + this.getArrivalTime()
  188. + "\nCustomer Name: " + this.getName()
  189. + "\nAddress: " + this.getAddress()
  190. + "\nCity: " + this.getCity()
  191. + "\nCounty: " + this.getCounty()
  192. + "\nContact Number: " + this.getContactNumber()
  193. + "\nProduct Description: " + this.getDescription()
  194. + "\nPrice: € " + this.getPrice()
  195. + "\nPrepaid: " + this.isPrePaid();
  196. }
  197. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement