---
# System prepended metadata

title: Mermaid

---

# Mermaid
## Group infomation:

| MSSV     | Họ tên                        |
| -------- | ----------------------------- |
|1712043   |   Trịnh Vũ Hoàng              |
|1712206   |   Nguyễn Hữu Vinh             |
|1712643   |   Nguyễn Đức Quỳnh Như        |

## Flow Chart
### Euclid
```mermaid
graph TD
	A[Bắt đầu] --> B[/Nhập a, b/] --> C{b = 0 ?}
	C -->|Sai| D{a > b ?}
	D -->|Đúng| E[a = a - b]
    D -->|Sai| F[b = b - a]
    E --> C
    F --> C
    C -->|Đúng| G[/Xuất a/]
    G --> H[Kết thúc]
```


### Quadratic
```mermaid
graph TD
	A[Bắt đầu] --> B[/Nhập a, b, c/]
    B --> C[delta = b^2 - 4*ac]
	C --> D{delta >= 0 ?}
	D -->|Đúng| E[x1 = -b/2a + d^0.5 / 2a]
    E --> F[x2 = -b/2a - d^0.5 / 2a]
    F --> G[/Xuất x1, x2/]
    D -->|Sai| H[/thông báo vô nghiệm/]
    G --> K[Kết thúc]
    H --> K
```

## Class Diagram
```mermaid
classDiagram
  Address "1" --* "1 Has" Customer
  Product "* Purchases" -- "1 Is Sold To" Customer
  Customer <|-- PremiumCustomer
  Customer <|-- RegularCustomer
  Customer -- PurchaseDetail
  Customer o-- "Belongs to" Bill
  Product -- PurchaseDetail
  PurchaseDetail <.. Bill
  PurchaseDetail <.. Discount
  Discount <.. Bill
  Bill ..|> Payment Counter: Accepts
  

  class Address{
    street: String
    city: String
    state: String
    zipcode: Int
    enterStreet()
    enterCity()
    enterState()
    enterZipcode()
  }
  class Customer{
    custName:String
    cusID: Int
    custPhnum: Int
    purchaseItem()
    requestBill()
    enterCustDetail() 
  }
  class PremiumCustomer{
    premiumDiscount: Int
    enterCustDetail()
  }
  class RegularCustomer{
    regularDiscount: Int
    enterCustDetail()
  }
  class Product{
    productID: Int
    productName: String
    productPrice: Float
    getPrice()
    setPrice()
  }
  class PurchaseDetail{
    custID: Int
    quantity: Int
    purchaseDate: Date
    productID: Int
    calculateTotalAmt()
    generatePurchaseList()
  }
  class Discount{
    discountType
    discountValue
    SelectDiscount()
  }
  class Bill{
    payableAmt
    calculatePayableAmt()
    generateBill()
  }
  class PaymentCounter{
    calculatePayableAmt()
    generateBill()
  }
```

## Sequence Diagram
```mermaid

sequenceDiagram
    participant Customer
    participant Search Page
    participant Search Results Page
    participant Catalog
    participant Search Results
    
    Customer->>+Search Page: 1: onSearch(author)
    Search Page->>Search Page: 1.1: validateSearchCriteria()
    alt author entered
        Search Page->>+Catalog: 1.2: searchByAuthor(author)
        Catalog->>+Search Results: 1.2.1: create()
        Search Results->>Search Results Page: 1.2.1.1: display()
        activate Search Results Page
        deactivate Search Results Page
        deactivate Search Results
    else author not entered
            deactivate Catalog
        Search Page->>-Search Page: 1.3: displayErrorMessage()
    end
```

## State Chart Diagram
```mermaid
stateDiagram
  I : Idle
  State VerifyAccount {
    VC : VerifyCard
    CV : CardValid
    VP : VerifyPin
    PI : PinIncorrect
    PC : PinCorrect
    VC: cardSubmitted
    VC: readCard
    VC: returnCard
    VP: pinSubmitted
    VP: checkPin
    VP: returnCard

    VC --> CardValid
    CV --> CardValid: [cardValid]
    CardValid --> [*]: else
    CV --> VP
    VP --> PinCorrect
    PinCorrect --> PC: [PinValid]
    PinCorrect --> PI: [else]
    PI --> VP: [tries < maxTries] / tries++
  }
  state Transaction {
  PR : PrintReicpt
  DM : DispenseMoney
  AA : AccountActions
  AA --> PR
  AA --> DM
  DM --> PR
  DM --> [*]:transaction complete
  PR --> [*]:transaction complete
  }
  [*] --> I
  I --> VerifyAccount
  VerifyAccount --> I
  Transaction --> I: transaction complete
 ``` 