12345678910111213141516171819202122232425262728293031323334353637383940414243 |
-
- /**
- * Created by leon on 1/10/18.
- */
- public class Product {
- // Create a product class which has a price, id, and quantity on hand
- private int price;
- private String id;
- private int onHand;
- public Product(int startPrice, String startId, int startOnHand){
- this.price = startPrice;
- this.id = startId;
- this.onHand = startOnHand;
- }
-
- public int getPrice() {
- return this.price;
- }
-
- public String getId() {
- return this.id;
- }
-
- public int getOnHand() {
- return this.onHand;
- }
-
- public int changePrice(int newPrice) {
- this.price = newPrice;
- return price;
- }
-
- public int addOnHand(int supply) {
- this.onHand = this.onHand + supply;
- return onHand;
- }
-
- public int totalValue(){
- return this.onHand * this.price;
- }
-
- }
|