Advertisement
aironman

Order

Dec 12th, 2019
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1.  
  2. import java.util.ArrayList;
  3. import java.util.List;
  4. import java.util.UUID;
  5.  
  6. public class Order {
  7.  
  8. private String id;
  9. private List<Product> products;
  10. private double totalPrize;
  11. private double totalTaxes;
  12.  
  13. public Order() {
  14. super();
  15. this.id=UUID.randomUUID().toString();
  16. this.products = new ArrayList<Product>();
  17. this.totalPrize = 0d;
  18. this.totalTaxes = 0d;
  19.  
  20. }
  21.  
  22. public List<Product> getProducts() {
  23. return products;
  24. }
  25.  
  26. public void addProduct(Product p) {
  27. this.products.add(p);
  28. }
  29. public double getTotalPrize() {
  30. return totalPrize;
  31. }
  32. public void setTotalPrize(double totalPrize) {
  33. this.totalPrize += totalPrize;
  34. }
  35. public double getTotalTaxes() {
  36. return totalTaxes;
  37. }
  38. public void setTotalTaxes(double totalTaxes) {
  39. this.totalTaxes += totalTaxes;
  40. }
  41.  
  42. @Override
  43. public String toString() {
  44. StringBuilder builder = new StringBuilder();
  45. builder.append("Order [id=").append(id).append(", products=").append(products).append(", totalPrize=")
  46. .append(totalPrize).append(", totalTaxes=").append(totalTaxes).append("]");
  47. return builder.toString();
  48. }
  49.  
  50.  
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement