jtentor icon

LinkedList 1er parte - Product.java

jtentor | PRO | 10/17/20 11:56:44 AM UTC | 1 ⭐ | 1680 👁️ | Never ⏰ | []
Java |

1.93 KB

|

None

|

1 👍

/

0 👎

//
// Created by Julio Tentor <[email protected]>
//
 
import java.text.SimpleDateFormat;
import java.util.Date;
 
public class Product {
 
    //region Attributes
    private Integer code;
    private String description;
    private Date expirationDate;
    private Float salePrice;
    //endregion
 
    //region Getters and Setters
    public Integer getCode() {
        return code;
    }
    public void setCode(Integer code) {
        this.code = code;
    }
 
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
 
    public Date getExpirationDate() {
        return expirationDate;
    }
    public void setExpirationDate(Date expirationDate) {
        this.expirationDate = expirationDate;
    }
 
    public Float getSalePrice() {
        return salePrice;
    }
    public void setSalePrice(Float salePrice) {
        this.salePrice = salePrice;
    }
    //endregion
 
    //region Constructors
    public Product() {
        this(0,"",new Date(), 0f);
    }
    public Product(Integer code, String description, Float salePrice) {
        this(code, description, new Date(), salePrice);
    }
    public Product(Integer code, String description, Date expirationDate, Float salePrice) {
        setCode(code);
        setDescription(description);
        setExpirationDate(expirationDate);
        setSalePrice(salePrice);
    }
    //endregion
 
    private final static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd/MM/YYYY");
 
    @Override
    public String toString() {
        return "Product{" +
                "code=" + getCode() +
                ", description='" + getDescription() + '\'' +
                ", expirationDate=" + simpleDateFormat.format(getExpirationDate()) +
                ", salePrice=" + getSalePrice() +
                '}';
    }
}
 

Comments