package ShopManagement; import java.io.Serializable; public class Product implements Serializable { private int ProductID; private String ProductName; private int UnitPrice;//bữa nó mếu chạy đc, nó bảo set static :)), =)) set chi 3 private static int Quantity; static int Price; // CONSTRUCTOR public Product(int productID, String productName, int unitPrice, int quantity) { ProductID = productID; ProductName = productName; UnitPrice = unitPrice; Quantity = quantity; } public Product() {} // GETTER SETTER public int getProductID() { return ProductID; } public void setProductID(int productID) { ProductID = productID; } public String getProductName() { return ProductName; } public void setProductName(String productName) { ProductName = productName; } public int getUnitPrice() { return UnitPrice; } public void setUnitPrice(int unitPrice) { UnitPrice = unitPrice; } public static int getQuantity() { return Quantity; } public static void setQuantity(int quantity) { Quantity = quantity; } public static int getPrice() { return Price; } // COMPUTE PRICE public void computePrice(){ this.setPrice(this.getQuantity() * this.getUnitPrice()); } public static int setPrice(int price) { Price = price; return price; } public String toString() { System.out.println("Product's ID\tProduct's name\t\tProduct's price per unit\tProduct's Quantity\t\tProduct's Price: "); return "\t" + ProductID + "\t\t\t" + ProductName + "\t\t\t\t" + UnitPrice + "\t\t\t\t\t\t\t" + Quantity + "\t\t\t\t" + Price; } }