70 likes | 194 Views
CSC 216/002. Lecture 2. UML Class Diagrams. What are the little numbers for on the edges leading from the box representing a class?. Is-a vs. Has-a. A poodle is-a dog . A car has-a transmission. Aggregation vs. Association. An aggregation is a set of objects that make up a unit.
E N D
CSC 216/002 Lecture 2
UML Class Diagrams • What are the little numbers for on the edges leading from the box representing a class?
Is-a vs. Has-a • A poodle is-a dog. • A car has-a transmission.
Aggregation vs. Association • An aggregation is a set of objects that make up a unit. • Example? • An association is two or more objects that work together, but one is not part of another. • Example?
Class-Responsibility-Collaborator • Classes: To find the objects, look for the nouns. • Responsibilities: Things a class knows or can do. • Collaborators: Other classes that are involved in fulfilling these responsibilities.
Requirements for the Course-Registration System • The mission is to automate registration of students for courses at a university. • Each student takes one or more courses, which are identified by name and course number. • Each course is worth one or more credit hours. • A student can register for up to 21 credit hours. • For each course that is taught, the students are placed into sections, which may meet at different times and be taught by different instructors. • If more than 50 students want to take the same class, another section will be added. • If fewer than 5 students register for a section, it will be canceled. • If no instructor can be persuaded (or hired) to teach a class, it will be canceled. • Students may specify alternate courses or sections, in case of a time conflict, or if their first-choice class is canceled. • After a student has registered for courses, (s)he will be e-mailed a class schedule.
Requirements for the Flight-Reservation System • The mission is to allow round-trip airline tickets to be bought over the Web. • Each customer specifies an origination point, a destination, and dates for outbound and return flights. • The customer reserves one outbound flight and one returnflight from a menu presented by the system. • Each choice that the system presents consists of one or more flight segments (there may be a change of planes). • The customer may buy tickets for one or more passengers. • No more tickets can be sold for a flight than there are seats on the plane. • Each passenger is assigned to a specific seat. • The system calculates the total cost of the tickets by adding the cost of the individual segments. • If dissatisfied with the cost, the customer may select alternate flights. • After a customer has bought a ticket, (s)he will be e-mailed a confirmation.