1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- package ui.controller;
- public class Gadget {
- /* 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 Gadget() {
- setName("TV");
- setAmount(1);
- setEnergy(10);
- this.isWorking = true;
- this.totalEnergy = getTotalEnergy();
- 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() {
- return 0;
- }
- }
|