This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Guyz will you please suggest me how can I proceed for this problem.
A well renowned hotel has three branches in Miami. Namely x,y and z .Each has two types of customers. Regular and Rewardee. Also each branch has its own ratings x is given a 3 star rating while y has 5 star rating and z has 4 star rating.Each hotel has specific rates for weekend and weekdays. x charges $100 for regular customers on weekdays and $120 on weekends While it is $90 for rewardee on weekdays and $95 on weekends. While z charges $195 for regular customers on weekdays and $150 on weekends. While its $120 for rewardee on weekdays and $90 on weekends. Now when the customer requests for a particular detail you need to find which hotel would yield the customer profit. In case of tie between hotels compare the ratings and provide the result.
Looking for a design pattern that fits this problem is not going to be very useful: there is none. The only advice I can give on how to proceed with this is the same thing you do for any problem: Break it down into smaller pieces, lay out what you know, what it is you are trying to figure out, and the steps you need to take to turn what you know into what you want to figure out.
Come up with a few candidate classes on your own and I can comment on your choices.
Rajat kumar jain
Joined: Dec 22, 2011
An interface Conditions
RegularAndWeekdays, RegularAndWeekends, RewardedAndWeekdays, RewardedAndWeekends are the classes implement them
An interface Hotel
HotelX HotelY HotelZ will implement that interface
Now all the conditions concrete classes will have a reference to hotel and it will instantiates each type of hotel
these classes have a function Calculate and they will calculate the charges for each hotel and then put them into the int variables
then i will find the smallest one of these ints and return that variable.