Files
004_comission/_resources/it114105/itp3914/Lab12/Ex1/Item.java
louiscklaw 6c60a73f30 update,
2025-01-31 19:15:17 +08:00

20 lines
439 B
Java

public class Item {
private String productCode;
private double price;
private int quantity;
public Item(String productCode, double price, int quantity) {
this.productCode = productCode;
this.price = price;
this.quantity = quantity;
}
public double getItemTotal() {
return price * quantity;
}
public String toString() {
return productCode +":" + price + "*" + quantity + "=" + getItemTotal();
}
}