Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. /**
  2. * Write a description of class Suite here.
  3. *
  4. * @author (your name)
  5. * @version (a version number or a date)
  6. */
  7. public class Suite
  8. {
  9. private String view;
  10. private String season;
  11. private int occupants;
  12.  
  13. double cost;
  14. /**
  15. * Constructor for objects of class Suite
  16. * @param view is the view
  17. * @param season is the time of the season
  18. * @param occupants is the amount of the occupants
  19. */
  20. public Suite(String view, String season, int occupants)
  21. {
  22. this.view = view;
  23. this.season = season;
  24. this.occupants = occupants;
  25. }
  26. /**
  27. * @return cost the cost
  28. */
  29. public double getCost()
  30. {
  31. if(view.equalsIgnoreCase("street") && season.equalsIgnoreCase("winter")) {
  32. if((occupants == 1 ) || (occupants == 2))
  33. cost = 150.0;
  34. else if((occupants == 3 ) || (occupants == 4))
  35. cost = 210.0;
  36. else
  37. cost = occupants * 200;
  38. }
  39. else if(view.equalsIgnoreCase("street") && season.equalsIgnoreCase("summer")) {
  40. if((occupants == 1 ) || (occupants == 2))
  41. cost = 200.0;
  42. else if((occupants == 3 ) || (occupants == 4))
  43. cost = 325.0;
  44. else
  45. cost = occupants * 200;
  46. }
  47. else if(view.equalsIgnoreCase("ocean") && season.equalsIgnoreCase("winter")) {
  48. if((occupants == 1 ) || (occupants == 2))
  49. cost = 175.0;
  50. else if((occupants == 3 ) || (occupants == 4))
  51. cost = 315.0;
  52. else
  53. cost = occupants * 200;
  54. }
  55. else if(view.equalsIgnoreCase("ocean") && season.equalsIgnoreCase("fall")) {
  56. if((occupants == 1 ) || (occupants == 2))
  57. cost = 250.0;
  58. else if((occupants == 3 ) || (occupants == 4))
  59. cost = 370.0;
  60. else
  61. cost = occupants * 200;
  62. }
  63. else if(view.equalsIgnoreCase("ocean") && season.equalsIgnoreCase("summer")) {
  64. if((occupants == 1 ) || (occupants == 2))
  65. cost = 250.0;
  66. else if((occupants == 3 ) || (occupants == 4))
  67. cost = 370.0;
  68. else
  69. cost = occupants * 200;
  70. }
  71. return cost;
  72. }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement