0% found this document useful (0 votes)
36 views23 pages

Introduction To Software Engineering Lab 4

The document discusses class diagrams and their components and relationships. It provides examples of how to represent generalization, association, composition, and aggregation relationships between classes in a class diagram. It then gives tasks to develop a class diagram for an online shopping system with classes like User, Customer, Admin, ShoppingCart, Orders, etc. and represent their attributes and relationships. It also provides an extra lab task to develop a class diagram for a car rental system with classes like Customer, Car, RentalAgency, RentalTransaction, Payment, Employee, Reservation and Location.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views23 pages

Introduction To Software Engineering Lab 4

The document discusses class diagrams and their components and relationships. It provides examples of how to represent generalization, association, composition, and aggregation relationships between classes in a class diagram. It then gives tasks to develop a class diagram for an online shopping system with classes like User, Customer, Admin, ShoppingCart, Orders, etc. and represent their attributes and relationships. It also provides an extra lab task to develop a class diagram for a car rental system with classes like Customer, Car, RentalAgency, RentalTransaction, Payment, Employee, Reservation and Location.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 23

INTRODUCTION TO SOFTWARE

ENGINEERING
LAB-4
OBJECTIVE: TO PRACTICE HOW TO DEVELOP
CLASS DIAGRAM FOR THE GIVEN SCENARIOS
CLASS DIAGRAM:
 A class diagram depicts classes and their interrelationships.
 Used for describing structure and behavior in the use cases.

 Provide a conceptual model of the system in terms of


entities and their relationships.
 Used for requirement capture, end-user interaction. Detailed
class diagrams are used for developers.
 Each class is represented by a rectangle subdivided into
three compartments.
 Name

 Attributes

 Operations
CLASS DIAGRAM:
 Modifiers are used to indicate visibility of attributes and
operations.
 ‘+’ is used to denote Public visibility (everyone)

 ‘#’ is used to denote Protected visibility (friends and


derived) ‘-’ is used to denote Private visibility (no one).
 By default, attributes are hidden and operations are
visible.
RELATIONSHIPS IN CLASS DIAGRAM:
 There are two kinds of Relationships
 Generalization ( exist between two related classes where
one is a specialized form of other)
 Association ( A relationship between two class )
Associations can be further classified as:
 Aggregation (Subclasses may or may not be depending
on the super class.)
 Composition (Subclasses depend on the super class.)
WHAT IS GENERALIZATION?
 Generalization implements Inheritance (A required
feature of object orientation).
 Generalization expresses a parent/child relationship
among related classes.
 Used for abstracting details in several layers
In the above diagram Generalization is represented, Superclass has
two child classes Sub type 1 and Sub type 2 connected by a
generalization relationship to their parent class
EXAMPLE:
THE ASSOCIATION RELATIONSHIP
 Represent relationship between instances of classes
 Association has two ends

 Role names (e.g. enrolls )

 Multiplicity (e.g. One course can have many students

 Navigability (unidirectional, bidirectional)


EXAMPLE:
COMPOSITION:
 Is a strong form of association
 Components have only one owner

 Components cannot exist independent of their owner

 Components live or die with their owner

 E.g. Each car has an engine that cannot be shared with


other cars.
 A type of association that represent a part-whole
relationship in which one element dies too when other
dies.
 Representation with a closed diamond symbol
AGGREGATION:
 May form "part of" the association, but may not be
essential to it. They may also exist independent of the
aggregate.
 A type of association that represent a part-whole
relationship in which one element lives independently of
its parent element.
 Representation by a open diamond symbol
TASK:
 Draw a Class Diagram Of Online Shopping System.
 The classes you will use are:

◦User.
◦ Customer.
◦ Admin.
◦ Shopping Cart.
◦ Shipping Info.
◦ Orders.
◦ Order Details.
 User:
 Attributes: Id, password, login status.

 Methods: Verify Login.

 Customer

 Attributes: Name, Address, Email, Credit Card, Shipping


Info.
 Methods: Register, Login Update Profile.

 Admin:

 Attributes: Name, Email.

 Methods: Update Catalog.


 Shopping Cart:
 Attributes: Cart ID, Product ID, Quantity, Date Added.

 Methods: Add cart item, Update quantity, view cart details, check out.

 Orders:

 Attributes: ID, Date created, Date shipped, customer name, customer


ID, status, shipping ID.
 Methods: place order.

 Shipping Info:

 Attributes: Shipping Id, shipping type, shipping cost, shipping region.

 Methods: Update shipping Info.

 Order Details:

 Attributes: Order ID, Product ID, product name, quantity, unit cost,
total.
 Methods: Calculate Price
EXTRA LAB TASK
 Customer: Represents the customers using the car rental service. It has attributes like
customerID, name, and contactInfo, as well as methods like rentCar() and returnCar().
 Car: Represents the individual cars available for rental. It has attributes like carID,
model, make, and rentalStatus.
 Rental Agency: Represents the car rental agency. It has attributes like agencyName
and location, and a relationship with Car indicating the cars available for rent.
 Rental Transaction: Represents a rental transaction. It has attributes like
transactionID, rentalDate, and returnDate. It also has a relationship with Customer
and Car.
 Payment: Represents the payment process for a rental. It has attributes like
paymentID, amount, and a relationship with RentalTransaction.
 Employee: Represents the employees of the rental agency. It has attributes like
employeeID, name, and role.
 Reservation: Represents car reservations made by customers. It has attributes like
reservationID, reservationDate, and a relationship with Customer and Car.
 Location: Represents the locations where the rental agency operates. It has attributes
like locationID, address, and a relationship with RentalAgency.

You might also like