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.

WriteIFs.java 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. // instance variables - replace the example below with your own
  31. int x;
  32. int tt_t;
  33. int tt_s;
  34. int oo1, oo2;
  35. String ss;
  36. /**
  37. * Constructor for objects of class WriteIFs
  38. */
  39. public WriteIFs()
  40. {
  41. // initialise instance variables
  42. x = 0;
  43. tt_t = 0;
  44. tt_s = 1;
  45. ss = "";
  46. oo1 = 61;
  47. oo2 = 49;
  48. }
  49. // associated routines
  50. public boolean isAlive(boolean p) {
  51. return !p;
  52. }
  53. private int tempurature(int t) {
  54. return t+2;
  55. }
  56. private void heatOn() {
  57. this.ss = "heating";
  58. }
  59. private void coolOn() {
  60. this.ss = "cooling";
  61. }
  62. private int insideTemp() {
  63. return oo1;
  64. }
  65. private int outsideTemp() {
  66. return oo2;
  67. }
  68. private void startAFire(Object o) {
  69. this.tt_s = 213;
  70. }
  71. private void refuel() {
  72. this.x = 99;
  73. }
  74. private void displayGameOver(boolean b) {
  75. this.ss = "Game Over!";
  76. }
  77. }