Question
Design Patterns Assignment For this assignment, you will be using four of the design patterns we discussed: Singleton Decorator Factory Observer You will use these
Design Patterns Assignment
For this assignment, you will be using four of the design patterns we discussed:
Singleton
Decorator
Factory
Observer
You will use these patterns in creating a Roach Motel. There can be only one Roach Motel. The Roach Motel will be created with an initial capacity (number of rooms).
When the motel is full, turn on the no vacancy sign. Otherwise the vacancy sign should be shown
Each of the rooms start out the same but you can add amenities when a customer checks in. Your customer will be a Roach Colony.
A Roach Colony has a name, an initial population, and a growth rate.
The base rate of a room is $50 per night.
The amenities include:
A food bar - add $10 per night
A spa - add $20 per night
Autorefill of the food bar - add $5 per night
Spray resistant shower - add $25 dollars per night
Roaches like to throw parties. Everytime they invite friends, the number of occupants in the room increase by their growth factor.
Whenever a RoachColony throws a party, the party is sprayed with insecticide. If the room has an antispray shower, the number of roaches is reduced by 25%. Without the shower, the number of roaches is reduced by 50%.
When the roaches check out, we calculate the bill as the room rate mulitplied by the numbers of days that the RoachColony has been our guest. Then we make that room available.
If a RoachColony tries to check in and there are no available rooms, we add them to a waitlist.
When a room does become vacant, we notify every colony on the list then clear out the list.
When the colony receives the notification, the colony will display a message that the notification has been received.
Grading Criteria
You will be graded on the following components:
Does the program do what is required
Is it properly documented
Is it fully tested
As always, remember to create a default constructor and override the toString() method for all classes.
Is it properly designed
Does it follow the design patterns
Were the design patterns used properly
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started