Concept explainers
Design a class to represent a credit card. Think about the attributes of a credit card; that is, what data is on the card? What behaviors might be reasonable for a credit card? Use the answer to these questions to write a UML class diagram for a credit card class. Then give three examples or instances of this class.
Unified Modeling Language (UML)
Unified Modeling Language (UML) is a modeling language in software engineering, which is used to visualize the design of the proposing system.
- In software development life cycle, it comes under the “documenting the program” phase.
- UML is used to document the developing system; this documentation helps the end user to understand the whole project.
- It visualizes all the components used in the developed object-oriented software; it shows all the elements and its relation.
Class diagram:
Class diagram is a static model which represents the system’s static structure and its relationship using attributes, relationships, objects, and operations.
- The relationship between the classes in the class diagram is called association.
- It is represented by drawing a line called association path between classes and placing the labels in between the association path.
- The instance of one class can be associated with more than one instance of another class and it is referred as multiplicity.
Steps to create class diagram:
- Identify objects
- Identify the attributes and behaviors
- Draw association between the classes.
Representing the class diagram:
- Every class in the class diagram is represented using a rectangle.
- The rectangle is divided into three parts,
- The first part contains the name of the class
- The middle part contains the attributes and derived attributes
- The last part contains the methods.
Class name |
-Attribute name |
+Operation name() |
Explanation of Solution
Attributes:
- Initially, identify the reasonable attributes for “CreditCard” class.
- The “CreditCard” contains the card number, card name, expiry date for card, and so on.
- So, let us take the followings are the attributes for “CreditCard” class.
- “cardNo”
- “name”
- “cardExpiryDate”
Explanation of Solution
Behaviors:
- Initially, identify the reasonable behaviors for “CreditCard” class.
- The “CreditCard” contains the “getCredit”, “getPurchase” and so on.
- So, let us take the followings are the behaviors for “CreditCard” class.
- “getCredit()”
- “getPurchase()”
Explanation of Solution
The UML class diagram for credit card is shown below:
The “CreditCard” class is shown in the following class diagram:
Explanation:
In the above diagram,
- The class name is “CreditCard”.
- The “cardNo”, “name”, and “cardExpiryDate” are attributes of “CreditCard” class.
- The “getCredit()” and “getPurchase()” are methods or operation name of “CreditCard” class.
- “getCredit()” method is used to gets the credit card amount from bank.
- “getPurchase()” is used to purchase the products by using the credit card.
Examples of objects of this “CreditCard”class:
First object:
The first object is “customer1” for this “CreditCard” class is shown below:
Explanation:
In the above diagram,
- The “customer1” object for “CreditCard” class.
- Assign the “cardNo” as “123456”, “name” as “XXXX” and “cardExpiryDate” as “03/02/2001” are the attributes of the “CreditCard” class.
Second object:
The second object is “customer2” for this “CreditCard” class is shown below:
Explanation:
In the above diagram,
- The “customer2” object for “CreditCard” class.
- Assign the “cardNo” as “234578”, “name” as “YYYY” and “cardExpiryDate” as “12/11/2022” are the attributes of the “CreditCard” class.
Third object:
The third object is “customer3” for this “CreditCard” class is shown below:
Explanation:
In the above diagram,
- The “customer3” object for “CreditCard” class.
- Assign the “cardNo” as “341579”, “name” as “ZZZZ” and “cardExpiryDate” as “01/02/2010” are the attributes of the “CreditCard” class.
Want to see more full solutions like this?
Chapter 5 Solutions
Java: An Introduction to Problem Solving and Programming (7th Edition)
Additional Engineering Textbook Solutions
Problem Solving with C++ (10th Edition)
Mechanics of Materials (10th Edition)
SURVEY OF OPERATING SYSTEMS
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Starting Out with C++ from Control Structures to Objects (9th Edition)
Elementary Surveying: An Introduction To Geomatics (15th Edition)
- 4. def modify_data(x, my_list): X = X + 1 my_list.append(x) print(f"Inside the function: x = {x}, my_list = {my_list}") num = 5 numbers = [1, 2, 3] modify_data(num, numbers) print(f"Outside the function: num = {num}, my_list = {numbers}") Classe Classe that lin Thus, A pro is ref inter Ever dict The The output: Inside the function:? Outside the function:?arrow_forwardpython Tasks 5 • Task 1: Building a Library Management system. Write a Book class and a function to filter books by publication year. • Task 2: Create a Person class with name and age attributes, and calculate the average age of a list of people Task 3: Building a Movie Collection system. Each movie has a title, a genre, and a rating. Write a function to filter movies based on a minimum rating. ⚫ Task 4: Find Young Animals. Create an Animal class with name, species, and age attributes, and track the animals' ages to know which ones are still young. • Task 5(homework): In a store's inventory system, you want to apply discounts to products and filter those with prices above a specified amount. 27/04/1446arrow_forwardOf the five primary components of an information system (hardware, software, data, people, process), which do you think is the most important to the success of a business organization? Part A - Define each primary component of the information system. Part B - Include your perspective on why your selection is most important. Part C - Provide an example from your personal experience to support your answer.arrow_forward
- Management Information Systemsarrow_forwardQ2/find the transfer function C/R for the system shown in the figure Re དarrow_forwardPlease original work select a topic related to architectures or infrastructures (Data Lakehouse Architecture). Discussing how you would implement your chosen topic in a data warehouse project Please cite in text references and add weblinksarrow_forward
- Please original work What topic would be related to architectures or infrastructures. How you would implement your chosen topic in a data warehouse project. Please cite in text references and add weblinksarrow_forwardWhat is cloud computing and why do we use it? Give one of your friends with your answer.arrow_forwardWhat are triggers and how do you invoke them on demand? Give one reference with your answer.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education