added tech_store

This commit is contained in:
2024-10-14 18:33:34 +02:00
parent f8e091216c
commit e51bfa3350
10 changed files with 373 additions and 0 deletions

36
Technikladen/Product.java Executable file
View File

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