Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Write a description of class Suite here.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class Suite
- {
- private String view;
- private String season;
- private int occupants;
- double cost;
- /**
- * Constructor for objects of class Suite
- * @param view is the view
- * @param season is the time of the season
- * @param occupants is the amount of the occupants
- */
- public Suite(String view, String season, int occupants)
- {
- this.view = view;
- this.season = season;
- this.occupants = occupants;
- }
- /**
- * @return cost the cost
- */
- public double getCost()
- {
- if(view.equalsIgnoreCase("street") && season.equalsIgnoreCase("winter")) {
- if((occupants == 1 ) || (occupants == 2))
- cost = 150.0;
- else if((occupants == 3 ) || (occupants == 4))
- cost = 210.0;
- else
- cost = occupants * 200;
- }
- else if(view.equalsIgnoreCase("street") && season.equalsIgnoreCase("summer")) {
- if((occupants == 1 ) || (occupants == 2))
- cost = 200.0;
- else if((occupants == 3 ) || (occupants == 4))
- cost = 325.0;
- else
- cost = occupants * 200;
- }
- else if(view.equalsIgnoreCase("ocean") && season.equalsIgnoreCase("winter")) {
- if((occupants == 1 ) || (occupants == 2))
- cost = 175.0;
- else if((occupants == 3 ) || (occupants == 4))
- cost = 315.0;
- else
- cost = occupants * 200;
- }
- else if(view.equalsIgnoreCase("ocean") && season.equalsIgnoreCase("fall")) {
- if((occupants == 1 ) || (occupants == 2))
- cost = 250.0;
- else if((occupants == 3 ) || (occupants == 4))
- cost = 370.0;
- else
- cost = occupants * 200;
- }
- else if(view.equalsIgnoreCase("ocean") && season.equalsIgnoreCase("summer")) {
- if((occupants == 1 ) || (occupants == 2))
- cost = 250.0;
- else if((occupants == 3 ) || (occupants == 4))
- cost = 370.0;
- else
- cost = occupants * 200;
- }
- return cost;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement