# Seminar 1 ## Thành viên | MSSV | Họ và tên | |:-------:|:-------------:| | 1712764 | Bùi Chí Thanh | | 1712780 | Hàng Hữu Thế | ## Flow Chart ### Euclide GCD ```mermaid graph TB id0([START]) id1[INPUT A, B] id2(( )) id3{B = 0 ?} id4{A > B ?} id5["B #larr; B - A"] id6["A #larr; A - B"] id7[PRINT A] id8(( )) id9([END]) style id8 fill:#000, stroke: black id0 --> id1 --> id2 --> id3 -->|no|id4 -->|no|id5 --> id8 --> id2 id3 -->|yes| id7 --> id9 id4 -->|yes| id6 -->id8 ``` ### Quadratic Equation ```mermaid graph TB id0([START]) id1[INPUT a, b, c] id2{a = 0 ?} id3{b = 0 ?} id4{c = 0 ?} id5[Vô số nghiệm] id6[Vô nghiệm] id7["x #larr; -c/b"] id8["#8710; #larr; b^2 - 4ac"] id9{"#8710; #ge; 0 ?"} id10{"#8710; = 0 ?"} id11["x #larr; -b/2a"] id12["x1 #larr; (-b+#radic;#8710;) / (2a) <br/> x2 #larr; (-b-#radic;#8710;) / (2a)"] id13["x1 #larr; -b/(2a) + #8520;#radic;(-#8710;) / (2a) <br/> x2 #larr; -b/(2a) - #8520;#radic;(-#8710;) / (2a)"] id14([END]) id0 --> id1 --> id2 --yes--> id3 --yes--> id4 --yes--> id5 id3 --no--> id7 id4 --no--> id6 id2 --no--> id8 --> id9 --yes--> id10 --yes--> id11 id10 --no--> id12 id9 --no--> id13 id5 & id7 & id6 & id11 & id12 & id13 --> id14 ``` ## Class Diagram ```mermaid classDiagram class Address { street: String city: String state: String zipcode: Int enterStreet() enterCity() enterState() enterZipcode() } class Product { productID: Int productName: String productPrice: Float getPrice() setPrice() } class Customer { custName: String custID: Int custPhnum: Int purchaseItem() requestBill() enterCustDetail() } class PremiumCustomer { premiumDiscount: Int enterCustDetail() } class RegularCustomer { regularDiscount: Int enterCustDetail() } class PurchaseDetail { custID: Int quantity: Int purchaseDate: Date productID: Int calculateTotalAmt() generatePurchaseList() } class Discount { discountType discountValue SelectDiscount() } class Bill { payableAmt calculatePayableAmt() generateBill() } class PaymentCounter { << interface >> calculatePayableAmt() generateBill() } Address "1" --* "1" Customer : has Product "*" -- "1" Customer : Purchases Product -- PurchaseDetail PurchaseDetail -- Customer Customer <|-- PremiumCustomer Customer <|-- RegularCustomer Customer o-- Bill : Belongs to PurchaseDetail <.. Bill PurchaseDetail <.. Discount Discount <.. Bill Bill ..|> PaymentCounter : Accepts ``` ## Sequence Diagram ```mermaid sequenceDiagram participant Customer participant SP as Search Page participant SRP as Search Result Page participant C as Catalog participant SR as Search Results Customer ->>+ SP : 1: onSearch(author) SP ->> SP : 1.1: validateSearchCriterial() alt author entered SP ->>+ C : 1.2: searchByAuthor(author) C ->>+ SR : 1.2.1: create() SR ->>+ SRP : 1.2.1.1: display() SRP -->>- SR : return SR -->>- C : return C -->>- SP : return else author not entered SP ->> SP : 1.3: displayErrorMessage() end SP -->>- Customer: return ``` ## State Diagram ```mermaid stateDiagram state Transaction { sPR: PrintReceipt sDM: DispenseMoney sAA: AccountActions sPR --> [*] :TransactionComplete sDM --> [*] :TransactionComplete sDM --> sPR sAA --> sDM sAA --> sPR } state1: Idle state VerifyAccount{ state VerifyCard{ cardSubmitted redCard returnCard } state5: CardValid state6: PinCorrect state7: PinInCorrect state VerifyPin{ cardSubmitted checkPin returnCard } VerifyCard --> state5:[CardValid] state5 --> VerifyPin VerifyPin --> state6: [PINValid] VerifyPin --> state7: PinCorrect[else] state7 --> VerifyPin: [tries< maxTries]/ tries++ VerifyCard --> Idle: [else] } [*] --> state1 Transaction --> state1 note right of state1 [*] (end) --> Idle VerifyCard (fault) --> Idle end note state1 --> VerifyAccount ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up