123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /**
  2. * Write a description of class WriteIFs here.
  3. *
  4. * @author (your name)
  5. * @version (a version number or a date)
  6. */
  7. public class WriteIFs
  8. {
  9. public void playerDied(boolean player1) {
  10. // Write an IF statement that checks “player1.isAlive()”
  11. // and if that’s false, calls “displayGameOver(player1)”
  12. }
  13. public String thermoSTAT(int room) {
  14. // Write an IF statement that checks the
  15. // “temperature(room)” and if that check is less than 70,
  16. // calls “heatOn()” else calls “coolOn()”
  17. return this.ss;
  18. }
  19. public void fireplaceControl(Object fireplace1) {
  20. // Write an IF statement that checks
  21. // “outsideTemp()” is less than 50
  22. // AND
  23. // “insideTemp()” is less than 62,
  24. // calls “startAFire(fireplace1)”
  25. }
  26. public void checkFuel(double fuelLevel) {
  27. // Write an IF statement that checks “fuelLevel”
  28. // and if that check is less than 0.08, calls “refuel()”
  29. }
  30. /**
  31. * Pay no attention to the code below this point.
  32. *
  33. *
  34. * instance variables
  35. * /
  36. int x;
  37. int tt_t;
  38. int tt_s;
  39. int oo1, oo2;
  40. String ss;
  41. /**
  42. * Constructor for objects of class WriteIFs
  43. */
  44. public WriteIFs()
  45. {
  46. // initialise instance variables
  47. x = 0;
  48. tt_t = 0;
  49. tt_s = 1;
  50. ss = "";
  51. oo1 = 61;
  52. oo2 = 49;
  53. }
  54. // associated routines
  55. public boolean isAlive(boolean p) {
  56. return !p;
  57. }
  58. private int tempurature(int t) {
  59. return t+2;
  60. }
  61. private void heatOn() {
  62. this.ss = "heating";
  63. }
  64. private void coolOn() {
  65. this.ss = "cooling";
  66. }
  67. private int insideTemp() {
  68. return oo1;
  69. }
  70. private int outsideTemp() {
  71. return oo2;
  72. }
  73. private void startAFire(Object o) {
  74. this.tt_s = 213;
  75. }
  76. private void refuel() {
  77. this.x = 99;
  78. }
  79. private void displayGameOver(boolean b) {
  80. this.ss = "Game Over!";
  81. }
  82. }