Product.java 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package Objects;
  2. import java.time.LocalDateTime;
  3. import java.time.format.DateTimeFormatter;
  4. public class Product {
  5. String name;
  6. String store;
  7. String url;
  8. String updatedDate;
  9. float price;
  10. public Product(String name, String store, String url) {
  11. super();
  12. this.name = name;
  13. this.store = store;
  14. this.url = url;
  15. }
  16. public String getName() {
  17. return name;
  18. }
  19. public String getStore() {
  20. return store;
  21. }
  22. public String getUrl() {
  23. return url;
  24. }
  25. public void setName(String name) {
  26. this.name = name;
  27. }
  28. public void setStore(String store) {
  29. this.store = store;
  30. }
  31. public void setUrl(String url) {
  32. this.url = url;
  33. }
  34. public String getUpdatedDate() {
  35. return updatedDate;
  36. }
  37. public void setUpdatedDate(String updatedDate) {
  38. this.updatedDate = updatedDate;
  39. }
  40. public void setUpdatedDate(LocalDateTime updatedDate) {
  41. this.updatedDate = updatedDate.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME);
  42. }
  43. public float getPrice() {
  44. return price;
  45. }
  46. public void setPrice(float price) {
  47. this.price = price;
  48. }
  49. @Override public String toString() {
  50. return String.format("Store %s Product name %s price %s updates %s", store, name, price, updatedDate);
  51. }
  52. }