csc 216/002

7
CSC 216/002 Lecture 2

Upload: melissa-stanley

Post on 31-Dec-2015

24 views

Category:

Documents


0 download

DESCRIPTION

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. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: CSC 216/002

CSC 216/002CSC 216/002

Lecture 2Lecture 2

Page 2: CSC 216/002

UML Class DiagramsUML Class Diagrams

What are the little numbers for on the edges leading from the box representing a class?

What are the little numbers for on the edges leading from the box representing a class?

Page 3: CSC 216/002

Is-a vs. Has-aIs-a vs. Has-a

A poodle is-a dog. A car has-a transmission.

A poodle is-a dog. A car has-a transmission.

Page 4: CSC 216/002

Aggregation vs. Association

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?

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?

Page 5: CSC 216/002

Class-Responsibility-Collaborator

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.

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.

Page 6: CSC 216/002

Requirements for the Course-Registration System

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.

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.

Page 7: CSC 216/002

Requirements for the Flight-Reservation System

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 return flight 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.

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 return flight 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.