TechStore code #1

Merged
Denys Konovalov merged 11 commits from ibartkowski/info-java:main into main 2024-10-14 19:12:16 +02:00
Showing only changes of commit fdb1719171 - Show all commits

@ -1,36 +1,34 @@
package tech_store; public class Product {
private int productID;
public class Product { private String productName;
private int productID; private int productPrice;
private String productName; private int productAmount;
private int productPrice; public Product(int id, String name, int price, int amt) {
private int productAmount; this.productID = id;
public Product(int id, String name, int price, int amt) { this.productName = name;
this.productID = id; this.productPrice = price;
this.productName = name; this.productAmount = amt;
this.productPrice = price; }
this.productAmount = amt; public int getID() {
} return this.productID;
public int getID() { }
return this.productID; public String getName() {
} return this.productName;
public String getName() { }
return this.productName; public int getPrice() {
} return this.productPrice;
public int getPrice() { }
return this.productPrice; public int getAmount() {
} return this.productAmount;
public int getAmount() { }
return this.productAmount; public void reduceAmount(int amt) {
} if (this.productAmount < amt) {
public void reduceAmount(int amt) { System.out.println("Not enough of product " + this.productID + "(" + this.productName + ") available!");
if (this.productAmount < amt) { return;
System.out.println("Not enough of product " + this.productID + "(" + this.productName + ") available!"); }
return; this.productAmount -= amt;
} }
this.productAmount -= amt; public void increaseAmount(int amt) {
} this.productAmount += amt;
public void increaseAmount(int amt) { }
this.productAmount += amt; }
}
}