Homework #2


Problem 1 (20 points)

Draw a conceptual UML class diagram for the classes WebMailSystem, Email, User, Folder, Attachment, Mailbox, and their semantic relationships and cardinalities. These classes are part of a project that models a web-based email system.


Problem 2 (30 points)

Assume the following requirements: "Design the software for the following vending machine. The vending machine must take coins and/or bills and dispense items that the user pushes buttons to select. The vending machine validates the money and displays the current total in the display window. The customer pushes a button which tells an item dispenser to dispense an item. If the customer has entered enough money for the item the vending machine will dispense the item and any change. The item dispensers must track the number of items in them and e-mail the supplier for the item to let the supplier know that they need more of that type of item when the number of items reaches a reorder level. The vending machine must know its location, and model number. There are two kinds of items. Items that need to be kept cold and those that don't. All items know their price. Cold items also know what temperature they need to be kept at."

(i) Draw a class diagram for the vending machine; identify the semantic relationships and cardinalities.

(ii) Draw the sequence diagram corresponding to a user buying item from the machine (normal flow).

(iii) Draw the state transition diagram for the vending machine.


Problem 3 (20 points)

Given the following UML write the corresponding Java code.


Problem 4 (30 points)

In this problem you'll get to write a little bit of JavaScript code. For simplicity, take the problem described in HW-1 and produce a JS implementation.

Notes:

  • Your code will be tested using Spidermonkey, running in the standard test environment for this class.
  • There is no main() in JS, code gets interpreted line by line
  • The requirement for unit-testing is waived for this problem; this is to spare you the need to learn a new unit-testing framework

Important: Don't forget to re-read the syllabus to make sure you understand all the deliverables for assignments in this class, including this one.



$Id: hw2.html,v 1.1 2013/03/31 03:38:35 virgil Exp $