package classes; public class HolonElement { /* Name of the gadget */ String name; /* Quantity */ int amount; /* Energy per gadget */ float energy; /* If the gadget is working xor not (true xor false) */ boolean isWorking; /* Total Energy */ float totalEnergy; public HolonElement(String name, int amount, float energy) { this.name = name; this.amount = amount; this.energy = energy; this.isWorking = true; System.out.println("You create some " + name + "'s. The amount is:" + amount); System.out.println("It's actual status is: " + isWorking); } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAmount() { return amount; } public void setAmount(int amount) { this.amount = amount; } public float getEnergy() { return energy; } public void setEnergy(float energy) { this.energy = energy; } public void switchGadget(boolean bool) { this.isWorking = bool; } public boolean getState() { return isWorking; } /** * Multiply the amount of gadgets, given by the user, and the * consumption/production. If the switch isWorking is turned off for on * gadget, the energy of this gadget have to be subtracted * * @return totalEnergy (actual) */ public float getTotalEnergy() { totalEnergy = ((float)amount)*energy; return totalEnergy; } }