1234567891011121314151617181920212223242526272829303132333435363738394041 |
-
- /**
- * Created by leon on 1/10/18.
- */
- public class Product {
-
- private double price;
- private int quantity;
- private String id;
-
- public Product(String id, double price, int quantity) {
- this.id = id;
- this.price = price;
- this.quantity = quantity;
- }
-
- public String getId() {
- return this.id;
- }
-
- public double getPrice() {
- return this.price;
- }
-
- public void changePrice(double newPrice) {
- price = newPrice;
- }
-
- public int getQuantity() {
- return this.quantity;
- }
-
- public void changeQuantity(int amount) {
- if (amount >= 0) {
- this.quantity += amount;
- } else {
- this.quantity -= amount;
- }
- }
- }
|