Sale Shop -billing: Billing -products: Product shopproducts: Products newSale: Sale +intializeProducts () +startBilling +Sale () +getDiscountPercentage () +calculateCost Product Billing -name: String +getDiscount () -price: double +Product () +getName () +getPrice () +setName () +setPrice () SeasonalBilling NormalBilling LoyaltyBilling SaleBilling +getDiscount () +getDiscount () +getDiscount () +getDiscount ()
Sale Shop -billing: Billing -products: Product shopproducts: Products newSale: Sale +intializeProducts () +startBilling +Sale () +getDiscountPercentage () +calculateCost Product Billing -name: String +getDiscount () -price: double +Product () +getName () +getPrice () +setName () +setPrice () SeasonalBilling NormalBilling LoyaltyBilling SaleBilling +getDiscount () +getDiscount () +getDiscount () +getDiscount ()
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Explain the following UML ClASS DIAGRAM
Expert Solution
Step 1
Aggregation:
- The aggregation relationship is also known as “has-a” relationship.
- The aggregation relationship states that objects of one class contain objects of a different class.
- For example, consider a quiz, which consists of questions. It can be said that the class “Quiz” aggregates the class “Question” because each quiz has one or more questions.
- In the UML notation, a line with a diamond-shaped symbol attached to the aggregating class denotes aggregation
Inheritance:
- Inheritance is the concept of inheriting the members and properties of a base class from the derived class.
- The main advantages of inheritance are,
- Code re-usability and fast implementation.
- Reduces the size of the program code.
- There are five types of inheritance:
- Single inheritance
- Multiple inheritance
- Hierarchical inheritance
- Multilevel inheritance
- Hybrid inheritance
- If a subclass inherits a base class, then the member functions and data members of the super class can be accessed by the derived class.
- But the derived class does not inherit the constructors from the base classes; each derived class should contain individual constructors.
- The main advantages of inheritance are,
Step 2
Explaining the diagram:
- The given UML diagram is a class diagram. In class diagram, the rectangular boxes are used to represent the classes.
- The arrow lines are used to show inheritance relation between two classes. The line with diamond shaped symbol is used to show the aggregation relationship between the classes.
- There are eight classes are in the diagram. That are,
- Shop
- This class is used to represent the shop.
- Class members are, “shopProducts”, “newSale”, “initializeProducts()” and “StartBilling()”.
- Sale
- This class is used to represent the sales.
- Class members are, “name”, “price”, “Product()”, “getName()”, “getPrice()”, “setName()” and “setPrice()”.
- Product
- This class is used to represent the product.
- Class members are, “Billing”, “products”, “Sale()”, “getDiscountPercentage()” and “calculateCost()”.
- Billing
- This class is used to represent the Billing.
- Class members are, “getDiscount()”.
- SeasonalBilling
- This class is used to represent the seasonal billing.
- Class members are, “getDiscount()”.
- NormalBilling
- This class is used to represent the normal billing.
- Class members are, “getDiscount()”.
- LoyaltyBilling
- This class is used to represent the loyalty billing.
- Class members are, “getDiscount()”.
- SaleBilling
- This class is used to represent the sale billing.
- Class members are, “getDiscount()”.
- Shop
Step by step
Solved in 3 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education