Files
kebab/src/main/java/project/utils/Ordersystem.java
T

109 lines
1.9 KiB
Java

package project.utils;
public class Ordersystem {
private int money = 0;
private int kebabPrice = 5;
private int upgradeLevel = 0;
private int kebabSold = 0;
private int workers = 0;
private int waitingCustomers = 0;
private int totalEarned = 0;
public int getMoney(){
return money;
}
public int getKebabSold(){
return kebabSold;
}
public void setKebabPrice(int price){
kebabPrice = price;
}
public boolean buyUpgrade() {
int cost = (upgradeLevel + 1) * 50;
if(money >= cost) {
money -= cost;
upgradeLevel++;
kebabPrice += 2;
return true;
}
return false;
}
public int getUpgradeLevel() {
return upgradeLevel;
}
public boolean buyWorker() {
int cost = getWorkerCost();
if(money >= cost) {
money -= cost;
workers++;
return true;
}
return false;
}
public int getWorkers() {
return workers;
}
public void addCustomer() {
waitingCustomers++;
}
public boolean sellKebab() {
if(waitingCustomers > 0) {
waitingCustomers--;
money += kebabPrice;
totalEarned += kebabPrice;
kebabSold++;
return true;
}
return false;
}
public int getTotalIncome() {
return totalEarned;
}
public int getWaitingCustomers() {
return waitingCustomers;
}
public int getKebabPrice() {
return kebabPrice;
}
public int getUpgradeCost() {
return (upgradeLevel + 1) * 50;
}
public int getWorkerCost() {
return 100 + workers * 50;
}
public void workerSellKebabs() {
for(int i = 0; i < workers; i++) {
if (waitingCustomers > 0) {
sellKebab();
}
}
}
}