Views: 7.9K
Replies: 1
Archived
|
Sample Pattern Problem: You must get fully dressed before leaving the houseCan anyone please tell me how should I approach this problem, what would be best way to solve this problem by keeping in mind the best possible design (pattern) approach, any help is greatly appreciated. Problem: You must get fully dressed before leaving the house Rules: Input: Temperature type (HOT|COLD) and a comma separated list of numeric commands Here are some example scenarios Successful Input: COLD 8, 6, 3, 4, 2, 5, 1, 7 Failure Input: HOT 8, 6, 6 Input: HOT 8, 6, 3 Input: COLD 8, 6, 3, 4, 2, 5, 7 Input: COLD 8, 6, 3, 4, 2, 5, 1 Input: COLD 6 Avanthika rachael, Sep 21, 2012
please someone provide me solution....plz...
Sep 21, 2012
|
|
Reply 1For this problem you can use "Visitor" pattern.
Define a Person class and different visitors for each accessory like footwear, pants etc. From the the console class based on the conditions, each "accessory visitor" will visit the "Person" Print the final output. Hope this helps you! Vivek Vivekananda P, Oct 18, 2012
|