---
# System prepended metadata

title: 'Team: anonymous_v2'

---

# Team: anonymous_v2
- 1712616 Đinh Văn Ngọc
- 1712582 Phạm Đình Luân
- 1712597 Phạm Bá Minh

# Seminar #1 - Mermaid
## Flow chart
- Euclide GCD
```mermaid
graph TB
  A[/Input number x and y/]--> B{x > y?}
  B-->|YES| C{y=0?}
  B-->|NO| D[swap x,y]
  D-->B
  C-->|YES| E[/return x/]
  C-->|NO| F[x=y and y=x%y]
  F--> C
```
- Quadratic Equation
```mermaid
graph TB
  A[/input a, b, c/] --> B{a=0?}
  B-->|NO|D[delta=b^2-4ac]
  B-->|YES|C{b=0?}
  D-->E{delta>0?}
  E-->|YES|F["x1=(-b+sqrt(delta))/2a<br/>x2=(-b-sqrt(delta))/2a"]
  F-->Z[/return x1,x2/]
  E-->|NO|G{delta=0?}
  G-->|YES|H["x1=x2=-b/2a"]
	H-->Z
  G-->|NO|I[/No solve/]
  C-->|YES|I
  C-->|NO|J[x=-c/b]
```
## Class Diagram



```mermaid
classDiagram
  Customer <|-- PremiumCustomer
  Customer <|-- RegularCustomer
  Customer o-- "Belongs to"Bill
  Customer --  PurchaseDetail
  Address "1"--* "1" Customer
  Product "*"--"1" Customer
  Product -- PurchaseDetail
  PurchaseDetail <.. Discount
  Discount <.. Bill
  PurchaseDetail <.. Bill
  PaymentCounter <|.. Bill :  Accepts
  class Address{
    street: String
    city: String
    state: String
    zipcode: Int
    enterStreet()
    enterCity()
    enterState()
    enterZipcode()
  }
	class Customer{
		custName: String
    custID: 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
    quanity: Int
    purchaseDate: Date
    productID: Int
    calculateTotalAmt()
    generarePurchaseList()
  }
	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
activate Customer
	Customer->>+Search Page: 1:OnSearch(author)
  Search Page->>Search Page: 1.1 validateSearchCriterial()  
  alt author entered
        Search Page->>Catalog:1.2 searchByAuthor(author)
        activate Catalog
        Catalog ->>Search Results:1.2.1: create()
        activate Search Results
        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
deactivate Customer
      

```

## State Chart Diagram
```mermaid
stateDiagram
  A :AccountActions
  B :DispenseMoney
  C :PrintReceipt
  D :Idle

  
  [*]-->D
  A-->B
  B-->C
  A-->C
  B-->Complete
  C-->Complete
  Complete-->D
  D-->VerifyAccount

  state VerifyAccount {
  E: Cardvalid
  F: PinCorrect
  G: PinIncorrect

  state Verifycard{
  cardSubmitted
  readcard
  returncard
  }

  state VerifyPin{
  PinSubmitted
  CheckPin
  returnCard
  }

  Verifycard--> CardValid
  CardValid -->E:cardValid
  E-->VerifyPin
  VerifyPin-->PinCorect
  PinCorect-->F:PINValid
  PinCorect -->G:else
 
  G-->VerifyPin:[tries < maxtries]/tries++
  }
```
