CPS 108: Coffee Machine Design Problem: Part 4

Spring 1999

Due at the end of class

Get into the group you were in for the last part of this activity. You may not work alone!

There are two parts to this activity:

Arnold gets competition

People are starting to buy Starbucks lattes instead of Arnold's coffees. So Arnold wants the machine modified just slightly, so that he can create a "drink of the week". He wants to be able to add new drinks and change prices anytime, to match his competition. He wants to be able to add espresso, cappuccino, hot chocolate, latte, choco-latte, steamed milk -- in short, anything he can mix together.

We add a couple more buttons, a milk steamer and dispenser, and a couple more powder dispensers.

Update your design to accommodate these changes and describe which parts of your class structure changed because of these new requirements.

Use Cases

Test your design against Arnold's change scenarios:
  1. Arnold decides on 35 cent coffees, espressos, and cappuccinos, and everything else 45 cents.
  2. Arnold decides to change the choco-latte to amaretto.
  3. Arnold wants to raise all prices by 10 cents.
For each of these scenarios, each person in the group should "be" one or more classes in your design. This means you should take the CRC card representing your card and try to act like that class should act during program execution. In playing this role, it is important to be extremely literal in your interpretation of the class' responsibilities. One good way to "get into character" is to pretend that your class is a company that is trying to be as profitable as possible. To be profitable, the company must be as accommodating as possible to its clients (collaborators) while at the same time doing as little as possible (i.e., delegating work to other companies (classes)).  As you play the role of your class, try to determine whether the work your class is doing is appropriate or should be the responsibility of another class.