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