Write bunch of java to solve a series of requirements and pass a series of tests to prove your code works the way it should.

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