Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1.  
  2. public class Apartment
  3. {
  4. private double kitchenLength;
  5. private double kitchenWidth;
  6.  
  7. private double denLength;
  8. private double denWidth;
  9.  
  10. private double bedroomLength;
  11. private double bedroomWidth;
  12.  
  13. public Apartment()
  14. {
  15. kitchenLength = 0;
  16. kitchenWidth = 0;
  17.  
  18. denLength = 0;
  19. denWidth = 0;
  20.  
  21. bedroomLength = 0;
  22. bedroomWidth = 0;
  23. }
  24.  
  25. public void setKitchenLength(double kitchenLength)
  26. {
  27. this.kitchenLength = kitchenLength;
  28. }
  29.  
  30. public void setKitchenWidth(double kitchenWidth)
  31. {
  32. this.kitchenWidth = kitchenWidth;
  33. }
  34.  
  35. public void setDenLength(double denLength)
  36. {
  37. this.denLength = denLength;
  38. }
  39.  
  40. public void setDenWidth(double denWidth)
  41. {
  42. this.denWidth = denWidth;
  43. }
  44.  
  45. public void setBedroomLength(double bedroomLength)
  46. {
  47. this.bedroomLength = bedroomLength;
  48. }
  49.  
  50. public void setBedroomWidth(double bedroomWidth)
  51. {
  52. this.bedroomWidth = bedroomWidth;
  53. }
  54.  
  55. public double getKitchenLength()
  56. {
  57. return kitchenLength;
  58. }
  59.  
  60. public double getKitchenWidth()
  61. {
  62. return kitchenWidth;
  63. }
  64.  
  65. public double getDenLength()
  66. {
  67. return denLength;
  68. }
  69.  
  70. public double getDenWidth()
  71. {
  72. return denWidth;
  73. }
  74.  
  75. public double getBedroomLength()
  76. {
  77. return bedroomLength;
  78. }
  79.  
  80. public double getBedroomWidth()
  81. {
  82. return bedroomWidth;
  83. }
  84.  
  85. public double getKitchenArea()
  86. {
  87. return kitchenLength * kitchenWidth;
  88. }
  89.  
  90. public double getDenArea()
  91. {
  92. return denLength * denWidth;
  93. }
  94.  
  95. public double getBedroomArea()
  96. {
  97. return bedroomLength * bedroomWidth;
  98. }
  99.  
  100. public double getTotalArea()
  101. {
  102. return getKitchenArea() + getDenArea() + getBedroomArea();
  103. }
  104. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement