Gadget.java 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package ui.controller;
  2. public class Gadget {
  3. /* Name of the gadget */
  4. String name;
  5. /* Quantity */
  6. int amount;
  7. /* Energy per gadget */
  8. float energy;
  9. /* If the gadget is working xor not (true xor false) */
  10. boolean isWorking;
  11. /* Total Energy */
  12. float totalEnergy;
  13. public Gadget() {
  14. setName("TV");
  15. setAmount(1);
  16. setEnergy(10);
  17. this.isWorking = true;
  18. this.totalEnergy = getTotalEnergy();
  19. System.out.println("You create some " + name + "'s. The amount is:" + amount);
  20. System.out.println("It's actual status is: " + isWorking);
  21. }
  22. public String getName() {
  23. return name;
  24. }
  25. public void setName(String name) {
  26. this.name = name;
  27. }
  28. public int getAmount() {
  29. return amount;
  30. }
  31. public void setAmount(int amount) {
  32. this.amount = amount;
  33. }
  34. public float getEnergy() {
  35. return energy;
  36. }
  37. public void setEnergy(float energy) {
  38. this.energy = energy;
  39. }
  40. public void switchGadget(boolean bool) {
  41. this.isWorking = bool;
  42. }
  43. public boolean getState() {
  44. return isWorking;
  45. }
  46. /**
  47. * Multiply the amount of gadgets, given by the user, and the
  48. * consumption/production. If the switch isWorking is turned off for on
  49. * gadget, the energy of this gadget have to be subtracted
  50. *
  51. * @return totalEnergy (actual)
  52. */
  53. public float getTotalEnergy() {
  54. return 0;
  55. }
  56. }