{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

iLab5 Pt2 Validation Solution

iLab5 Pt2 Validation Solution - -Begin Declare same as...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 iLab 5, Part 2: PSEUDOCODE (directly from "hint" flowchart) -------------------------------------------------------------- Begin Button_Click() Declare object, variables: ...OrderCalculator objOrdCalc ... Double finalTotal ... Boolean isValid=True If txtOrderAmount.Text is NOT numeric ...then isValid=false ... Display error message [Following inserted from REVISED flowchart for completeness: ...else If OrderAmount <= 0 ...... then isValid=false ...... Display error message ... end if ] end if If txtSalesTax.Text is NOT numeric ... then isValid=false ... Display error message ... else If SalesTax < 0 OR SalesTax > .14 ....... then isValid=false ....... Display error message ... end if end if If isValid ...then Get objOrdCalc.OrderAmount, objOrdCalc.SalesTaxPercent ... finalAmount = objOrdCalc.GetTotalAfterDiscount() ... Display finalAmount end if End SAME SOLUTION PSEUDOCODE (using positive validation ONLY, specific error messages):
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: -----------------------------------------------------------------------------------Begin, Declare: same as above if txtOrderAmount.Text is numeric ...then if txtOrderAmount.Text > 0 ...... then continue ...... else isValid=false ...... Display "Order Amount is not positive" ...end if Sheet1 Page 2 ...else isValid=false ... Display "Order Amount non-numeric" end if if txtSalesTax.Text is numeric ... then if txtSalesTax.Text > 0 AND txtSalesTax.Text <= .14 ...... then continue ...... else isValid=false ...... Display "Sales Tax out of valid range" ... end if ... else isValid=false ... Display "Sales Tax is non-numeric" end if If isValid ...then Get objOrdCalc.OrderAmount, objOrdCalc.SalesTaxPercent ... finalAmount = objOrdCalc.GetTotalAfterDiscount() ... Display finalAmount end if End...
View Full Document

{[ snackBarMessage ]}