diff --git a/src/main/java/project/utils/Ordersystem.java b/src/main/java/project/utils/Ordersystem.java index 029ceb0..a4b2729 100644 --- a/src/main/java/project/utils/Ordersystem.java +++ b/src/main/java/project/utils/Ordersystem.java @@ -1,13 +1,15 @@ +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 void sellKebab() { - money += kebabPrice; - kebabSold++; - } public int getMoney(){ return money; } @@ -18,6 +20,89 @@ public class Ordersystem { 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(); + } + } + + } }