Problem 1
Name three major relationships that could exist between classes \(A\) and \(B\). Describe them in your own words. Express each in UML and in a typical Java implementation.
Problem 2
Explain the difference between aggregation and composition. Give an example to support your answer.
Problem 4
Draw the class diagram for the following code. Explain the correspondence between the code and the diagram. abstract class A ( ) class B ( \(B()()\) ) class C extends A abstract class A ( ) class B ( B()() class C extends A ( B b=new B( ); l \(\mathrm{Bb}=\) new \(\mathrm{B}(\mathrm{)}\);
Problem 5
A library has a collection of items (books and magazines) available to loan patrons. For each item in the collection, the system maintains data about its title, author, and unique id. In addition, the copyright year is maintained for books, and the edition number is maintained for magazines. Draw a UML. class diagram representing the library items. Be sure to include the required attributes. Hint: Use inheritance in your model.
Problem 6
Show a class diagram for an application that displays automobiles. Depending on the user's request, it displays a typical Ford, Toyota, or Chevy, together with interactive pages of information about each. We want to be able to easily add new automobile brands to the application in the future and to reuse parts of the design where possible.
Problem 7
Suppose that your car has a built-in application that displays the status of the engine parts at all times. Draw a UML state diagram for the Staricr class that describes the automobile's starter only. Explain your reasoning. Note that the starter is sometimes connected to and sometimes disengaged from the car's motor. The starter reacts to actions involving the car key. The key can be in one of three positions: vertical, \(90^{\circ}\), and \(180^{\circ}\).
Problem 8
Consider an application used at a doctor's office. The application schedules patient appointments and maintains patient medical histories. Suppose the application design contains an Appointment class to track appointments, and a MedicalHislary class for each patient. How would you draw the UML class relationship between these two classes?
Problem 9
Consider the following use case for a web e-commerce application= Use Case Name: "Select Item" Actor: Shopper Precondition: Actor has requested product list Scenario: 1\. Application displays product list 2\. User selects item on product list 3\. User clicks "add item to shopping cart" button 4\. System acknowledges item placed in shopping cart Draw a UML sequence diagram for this use case. Explain your reasoning.