public class Cabin
extends java.lang.Object
Modifier and Type | Field | Description |
---|---|---|
static int |
MAX_PEOPLE_PER_ROOM |
|
java.lang.String |
name |
The name for this Cabin.
|
int |
numRooms |
The number of bedrooms this Cabin has.
|
static int |
USUAL_PEOPLE_PER_ROOM |
Constructor | Description |
---|---|
Cabin(java.lang.String name,
int numRooms) |
Create a Cabin with the given name and number of bedrooms.
|
Modifier and Type | Method | Description |
---|---|---|
double |
getBasicRent() |
The basic rent for this Cabin, based on number of rooms.
|
double |
getCurrentRent() |
Calculate how much rent this room is bringing in.
|
int |
getMaxOccupancy() |
Get the maximum capacity of this Cabin.
|
java.lang.String |
getName() |
Get the name of this Cabin.
|
int |
getNumOccupants() |
Get the current number of occupants.
|
int |
getNumRooms() |
Get the number of bedrooms in this Cabin.
|
double |
getSurcharge() |
The surcharge for this Cabin, based on the number of people in it.
|
boolean |
isOccupied() |
Return whether this room is occupied.
|
void |
removeOccupants() |
Mark this room as open for rental.
|
static void |
setBaseRate(double rate) |
Set the basic rental rate for all Cabins.
|
static void |
setExtraPersonRate(double rate) |
Set the surcharge for each extra person in the Cabin.
|
static void |
setExtraRoomRate(double rate) |
Set the amount the rate rises for every bedroom after the first.
|
void |
setOccupants(int numOccupants) |
Rent this Cabin to a group of the given size.
|
public static final int MAX_PEOPLE_PER_ROOM
public static final int USUAL_PEOPLE_PER_ROOM
public final java.lang.String name
public final int numRooms
public Cabin(java.lang.String name, int numRooms)
name
- the name of this CabinnumRooms
- the number of bedrooms for this Cabinjava.lang.IllegalArgumentException
- if the number of rooms is less than onepublic java.lang.String getName()
public int getNumRooms()
public int getNumOccupants()
public double getCurrentRent()
public double getBasicRent()
public double getSurcharge()
public boolean isOccupied()
public void setOccupants(int numOccupants)
numOccupants
- the number of people to register in this Cabinjava.lang.IllegalArgumentException
- if the number of occupants is less than
one or more than the maximum occupancy for this Cabin.public void removeOccupants()
public int getMaxOccupancy()
public static void setBaseRate(double rate)
rate
- the rental rate for a basic Cabinpublic static void setExtraRoomRate(double rate)
rate
- how much extra each bedroom is in rentpublic static void setExtraPersonRate(double rate)
rate
- how much extra each person raises the rent