Java Reference
In-Depth Information
Users place coins in a vending machine and select a product by
pushing a button. If the inserted coins are sufficient to cover the
purchase price of the product, the product is dispensed and change is
given. Otherwise, the inserted coins are returned to the user.
What classes should you use to implement it?
΢΢ Exercise R8.2. Consider the following problem description:
Employees receive their biweekly paychecks. They are paid their
hourly rates for each hour worked; however, if they worked more
than 40 hours per week, they are paid overtime at 150% of their
regular wage.
What classes should you use to implement it?
΢΢ Exercise R8.3. Consider the following problem description:
Customers order products from a store. Invoices are generated to list
the items and quantities ordered, payments received, and amounts
still due. Products are shipped to the shipping address of the
customer, and invoices are sent to the billing address.
What classes should you use to implement it?
΢΢΢ Exercise R8.4. Look at the public interface of the
java.lang.System class and discuss whether or not it is cohesive.
΢΢ Exercise R8.5. Suppose an Invoice object contains descriptions of the
products ordered, and the billing and shipping address of the customer.
Draw a UML diagram showing the dependencies between the classes
Invoice , Address , Customer , and Product .
΢΢ Exercise R8.6. Suppose a vending machine contains products, and users
insert coins into the vending machine to purchase products. Draw a UML
diagram showing the dependencies between the classes
VendingMachine , Coin , and Product .
Search WWH ::




Custom Search