---
# System prepended metadata

title: Untitled

---

### Serminar #1 - Mermaid

### *Sinh viên thực hiện: Hoàng Lê Văn - MSSV: 1512660*
## Flow Chart
* ### Mermaid Code

```
graph TD

%% Euclide GCD
	A([Main]) --> B[/Input A/]--> C[/Input B/]
	C-->D{{B == 0}} -->|True|E{A > B}
	E-->|True|F[A = A - B]
	E-->|False|G[B = B - A]
	G-->H((.))
	F-->H((.))
	D-->|False|I[/Output A/]-->J([End])
	H-->D

%% Quadratic Equation
	A1([Main])-->B1[/Input A,B,C/]
	B1-->C1[D = b*b - 4*a*c]-->D1{D >= 0}
	D1-->|False|E1(No real solution)
	D1-->|True|F1[x1 = <-b + sqrt<d>>/<2*a> ]-->F2[x2 = <-b - sqrt<d>>/<2*a> ]
	F2-->F3(Print x1,x2)-->G1((.))
	E1-->G1-->H1([End])

```
* ### Result
![](https://i.imgur.com/w9sVuu2.png)
## Class Diagram
* ### Mermaid Code

```
classDiagram
	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 Product{
		productID: Int
		productName: String
		productPrice: Float
		getPrice()
		setPrice()
	}

	class PurchaseDetail{
		custID: Int
		quantity: Int
		purchaseDate: Date
		productID: Int
		calculateTotalAmt()
		generatePurchaseList()
	}

	class Discount{
		discountType: Int
		discountValue: Int
	}

	class PremiumCustomer{
		premiumDiscount: Int
		enterCustDetail()
	}

	class RegularCustomer{
		regularDiscoun: Int
		enterCustDetail()
	}

	class Bill{
		payableAmt: Int
		calculatePayableAmt()
		generateBill()
	}

	class PaymentCounter{
		calculatePayableAmt()
		generateBill()
	}
					
	Customer *--  Address : Has
	Customer -- Product
	Product -- PurchaseDetail : Purchase
	PurchaseDetail -- Product : Is sold to
	Customer -- PurchaseDetail
	Customer <|-- PremiumCustomer
	Customer <|-- RegularCustomer
	Customer *-- Bill : Belongs to
	PurchaseDetail <.. Discount
	PurchaseDetail <.. Bill
	Discount <.. Bill
	PaymentCounter <|.. Bill
```
* ### Result
![](https://i.imgur.com/TTOiT8h.png)
## Squence Diagram
* ### Mermaid Code
```
sequenceDiagram
					
	participant Customer
	participant Search Page
	participant Search Result Page
	participant Catalog
	participant Search Result

	Customer ->> Search Page: 1: onSearch(author)
	Search Page ->> Search Page : 1.1: validateSearchCriterial()
	alt author entered
		Search Page ->> Catalog : 1.2: searchByAuthor(author)
		Catalog ->> Search Result: 1.2.1: create()
		Search Result ->> Search Result Page: 1.2.1.1: display() 
		else is author not entered
		Search Page ->> Search Page: 1.3: displayErrorMessage()
	end
```
* ### Result
* ![](https://i.imgur.com/g91cDrD.png)
## StateDiagram
* ### Mermaid Code
```
stateDiagram
	[*]-->Idle
	PrinceReceipt-->[*]
	DispenseMoney-->[*]
	DispenseMoney-->PrinceReceipt
	AccountAcction-->DispenseMoney
	AccountAcction-->PrinceReceipt
	Idle-->[*]
	state VerifyAccount
	{
		vc: VerifyCard
		CardValidCheck
		cv: CardValid
		vp: VerifyPin
		PinCorrectCheck
		pc: PinCorrect
		pi: PinIncorrect

		vc-->CardValidCheck
		CardValidCheck-->cv:[cardValid]
		cv-->vp
		vp-->PinCorrectCheck
		PinCorrectCheck-->pc:[PINValid]
		PinCorrectCheck-->pi:[else]
		pi-->vp:[tries<maxTries] / tries++
	}
	Idle-->VerifyAccount
	VerifyAccount-->Idle:[CardValidCheck-false]		
```
* ### Result
![](https://i.imgur.com/yhkCUSh.png)
