Advertisement
jtentor

LinkedList 1er parte - Product.java

Oct 17th, 2020
1,100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.93 KB | None | 0 0
  1. //
  2. // Created by Julio Tentor <jtentor@fi.unju.edu.ar>
  3. //
  4.  
  5. import java.text.SimpleDateFormat;
  6. import java.util.Date;
  7.  
  8. public class Product {
  9.  
  10.     //region Attributes
  11.     private Integer code;
  12.     private String description;
  13.     private Date expirationDate;
  14.     private Float salePrice;
  15.     //endregion
  16.  
  17.     //region Getters and Setters
  18.     public Integer getCode() {
  19.         return code;
  20.     }
  21.     public void setCode(Integer code) {
  22.         this.code = code;
  23.     }
  24.  
  25.     public String getDescription() {
  26.         return description;
  27.     }
  28.     public void setDescription(String description) {
  29.         this.description = description;
  30.     }
  31.  
  32.     public Date getExpirationDate() {
  33.         return expirationDate;
  34.     }
  35.     public void setExpirationDate(Date expirationDate) {
  36.         this.expirationDate = expirationDate;
  37.     }
  38.  
  39.     public Float getSalePrice() {
  40.         return salePrice;
  41.     }
  42.     public void setSalePrice(Float salePrice) {
  43.         this.salePrice = salePrice;
  44.     }
  45.     //endregion
  46.  
  47.     //region Constructors
  48.     public Product() {
  49.         this(0,"",new Date(), 0f);
  50.     }
  51.     public Product(Integer code, String description, Float salePrice) {
  52.         this(code, description, new Date(), salePrice);
  53.     }
  54.     public Product(Integer code, String description, Date expirationDate, Float salePrice) {
  55.         setCode(code);
  56.         setDescription(description);
  57.         setExpirationDate(expirationDate);
  58.         setSalePrice(salePrice);
  59.     }
  60.     //endregion
  61.  
  62.     private final static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd/MM/YYYY");
  63.  
  64.     @Override
  65.     public String toString() {
  66.         return "Product{" +
  67.                 "code=" + getCode() +
  68.                 ", description='" + getDescription() + '\'' +
  69.                 ", expirationDate=" + simpleDateFormat.format(getExpirationDate()) +
  70.                 ", salePrice=" + getSalePrice() +
  71.                 '}';
  72.     }
  73. }
  74.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement