1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 “outsideTemp()”
  21. // is less than 50 AND “insideTemp()”
  22. // is less than 62, calls “startAFire(fireplace1)”
  23. }
  24. public void checkFuel(double fuelLevel) {
  25. // Write an IF statement that checks “fuelLevel”
  26. // and if that check is less than 0.08, calls “refuel()”
  27. }
  28. // instance variables - replace the example below with your own
  29. int x;
  30. int tt_t;
  31. int tt_s;
  32. String ss;
  33. /**
  34. * Constructor for objects of class WriteIFs
  35. */
  36. public WriteIFs()
  37. {
  38. // initialise instance variables
  39. x = 0;
  40. tt_t = 0;
  41. tt_s = 1;
  42. ss = "";
  43. }
  44. // associated routines
  45. public boolean isAlive(boolean p) {
  46. return !p;
  47. }
  48. private int tempurature(int t) {
  49. return t+2;
  50. }
  51. private void heatOn() {
  52. this.ss = "heating";
  53. }
  54. private void coolOn() {
  55. this.ss = "cooling";
  56. }
  57. private int insideTemp() {
  58. return 61;
  59. }
  60. private int outsideTemp() {
  61. return 49;
  62. }
  63. private void startAFire(Object o) {
  64. this.tt_s = 213;
  65. }
  66. private void refuel() {
  67. this.x = 99;
  68. }
  69. private void displayGameOver(boolean b) {
  70. this.ss = "Game Over!";
  71. }
  72. }