0% found this document useful (0 votes)
16 views3 pages

11223377

343342

Uploaded by

Toni Player936
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views3 pages

11223377

343342

Uploaded by

Toni Player936
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Sure, let's design a system for automation.

I'll choose a simple yet practical example: an Online Shopping


System. Here are the steps you requested:

**Step 1: Extract Main Objects (Entities):**

- Customer

- Product

- Shopping Cart

- Order

- Payment

**Step 2: Find Necessary Attributes and Functions:**

- **Customer:**

- Attributes: Name, Email, Address

- Functions: RegisterAccount(), Login(), Logout(), ViewProducts(), AddToCart(), MakePayment()

- **Product:**

- Attributes: Name, Description, Price, StockQuantity

- Functions: ViewDetails(), CheckStock()

- **Shopping Cart:**

- Attributes: CartItems (List of Products), TotalPrice

- Functions: AddToCart(), RemoveFromCart(), CalculateTotal()

- **Order:**

- Attributes: OrderNumber, Date, Customer, OrderItems (List of Products), TotalAmount

- Functions: PlaceOrder(), CancelOrder(), CalculateTotal()

- **Payment:**
- Attributes: PaymentMethod, Amount, Order

- Functions: ProcessPayment(), VerifyPayment()

**Step 3: Identify Relationships Between Objects:**

- A **Customer** can have multiple **Orders**.

- An **Order** is associated with one **Customer**.

- An **Order** consists of multiple **Products**.

- A **Product** can belong to multiple **Orders**.

- A **Shopping Cart** is associated with one **Customer** and contains multiple **Products**.

- A **Payment** is associated with one **Order**.

**Step 4: Construct a Class Diagram:**

Using standard UML notations, here's a simplified class diagram for the Online Shopping System:

```

+------------------+ +--------------+ +----------------+

| Customer | | Product | | Shopping Cart |

+------------------+ +--------------+ +----------------+

| -Name | | -Name | | -CartItems |

| -Email | | -Description | | -TotalPrice |

| -Address | | -Price |<------>| |

| |<------>| -StockQty | | |

| +RegisterAccount()| | +ViewDetails()| | +AddToCart() |

| +Login() | | +CheckStock() | | +RemoveFromCart()|

| +Logout() | | | | +CalculateTotal()|

| +ViewProducts() | | | | |

| +AddToCart() | | | | |
| +MakePayment() | | | | |

+------------------+ +--------------+ +----------------+

| ^ ^

| | |

| | |

v | |

+------------------+ +--------------+ +----------------+

| Order | | Payment |

+------------------+ +--------------+

| -OrderNumber | | -PaymentMethod|

| -Date | | -Amount |

| -TotalAmount | | |

| |<------>| |

| +PlaceOrder() | | +ProcessPayment()|

| +CancelOrder() | | +VerifyPayment() |

| +CalculateTotal()| +------------------+

+------------------+

```

This class diagram shows the main objects, their at kktributes, and functions, as well as the relationships
between them. It incorporates key OOP concepts like encapsulation, association, composition (Shopping
Cart), and inheritance (not shown in this simplified diagram).

You might also like