DeVry BIS 311 Week 5 iLab Latest

$25

Quantity:

Description

DeVry BIS 311 Week 5 iLab Latest

Print

iLab 5 of 7: User Interface Validation (50 points)

Note!

Submit your assignment to the Dropbox, located at the top of this page.

(See the Syllabus section “Due Dates for Assignments & Exams” for due dates.)

iLAB OVERVIEW

Scenario/Summary

In this lab, you’ll implement an application that performs a simple sales tax calculation. The new feature of this application, compared to what you have done in previous iLabs, is that the values entered by the user will be checked for validity. If the amounts entered are invalid, the application will display appropriate error messages to the user. If the input data are valid, the application will calculate the sales tax due and the total, including tax.

Sales Tax Application Business Requirements

The user enters an order amount and a sales tax percent. The order amount must be numeric and greater than 0. The sales tax percent must be numeric, greater than or equal to 0, and less than or equal to 0.14. If the input data are invalid, appropriate error messages will be displayed to the user. If the input data are valid, the application will calculate the sales tax by multiplying the order amount by the sales tax percent, and will calculate the order total, including tax, by adding the order amount and the sales tax. The sales tax and the order total, including tax, will be displayed to the user.

TOE Chart for Sales Tax Application

Task Object Event

Get the following inputs from the user:

Order amount txtOrderAmount

Sales tax percent txtTaxPercent

Perform the following processing: btnCalcTotal Click

Validate inputs

Calculate Tax = Order amount * Sales tax percent

Calculate Order total = Order amount Tax

Display the following outputs:

Error messages (if input invalid) lstMessages

Tax (if input valid) lstMessages

Order total (if input valid) lstMessages

Pseudocode for Sales Tax Application

Start button-click event handler

Declare numeric variables for

Order amount

Sales tax percent

Tax

Order total

Declare string variables for

Order amount message

Sales tax percent message

Declare Boolean variable for

Inputs valid (initialize to True)

Clear messages

Call ValidateOrderAmount function with Order amount, returning Order amount message

If Order amount message is not empty (i.e. there was an error)

Display Order amount message

Set Inputs valid to False

End If

Call ValidateSalesTaxPercent function with Sales tax percent, returning Sales tax percent message

If Sales tax percent message is not empty (i.e. there was an error)

Display Sales tax percent message

Set Inputs valid to False

End If

If Inputs valid is True

Get Order amount

Get Sales tax percent

Calculate Tax = Order amount * Sales tax percent

Calculate Order total = Order amount Tax

Display Tax

Display Order amount

End If

Stop button-click event handler

Start ValidateOrderAmount function (Order amount)

If Order amount is not numeric

Set Order amount message to “Please enter a numeric order amount.”

Else If Order amount is less than or equal to zero

Set Order amount message to “Please enter an order amount greater than zero.”

Else

Set Order amount message to the empty string (no error)

End If

Return Order amount message

Stop ValidateOrderAmount

Start ValidateSalesTaxPercent (Sales tax percent)

If Sales tax percent is not numeric

Set Sales tax percent message to “Please enter a numeric sales tax percent.”

Else If Sales tax percent is less than zero or greater than 0.14

Set Sales tax percent message to “Please enter a sales tax percent between 0.00 and 0.14.”

Else

Set Sales tax percent message to the empty string(no error)

End If

Return Sales tax percent message

Stop ValidateSalesTaxPercent

Deliverables

Submit a Word document named Lab5YourFirstLastName.docx (where YourFirstLastName = your first and last name; e.g., Lab5JohnSmith.docx) containing the following:

Screenshot of form showing the application running, with non-numeric entries for Order amount and Sales tax percent, and appropriate error messages displayed.

Screenshot of form showing the application running, with out-of-range entries for Order amount and Sales tax percent, and appropriate error messages displayed.

Screenshot of form showing the application running, with valid entries for Order amount and Sales tax percent, and correct Tax and Order total results displayed.

Copy of code for button-click event, ValidateOrderAmount function, and ValidateSalesTaxPercent function.

Category Points % Description

Create and rename form 5 10% Windows form was created and renamed SalesTax.vb. Form text property was set to Lab 5 Your Name (where Your Name = your full name).

Add controls to form 5 10% The following controls were added to the form: Identifying labels and text boxes for entry of order amount and sales tax percent; button to calculate total including tax; and list box for display of error messages and results.

Set properties for controls 5 10% Name and text properties of all controls were set appropriately, with no typos or spelling errors.

Code button-click event 5 10% Button-click event code was entered that corresponds to the given pseudocode, with no syntax errors.

Code ValidateOrderAmount function 5 10% Function code was entered that corresponds to the given pseudocode, with no syntax errors.

Code ValidateSalesTaxPercent function 5 10% Function code was entered that corresponds to the given pseudocode, with no syntax errors.

Test-run application successfully 20 40% Application is shown running successfully with screen shots for each of the three test cases: (1) non-numeric entries for order amount and sales tax percent, with appropriate error messages; (2) out-of-range entries for order amount and sales tax percent, with appropriate error messages; and (3) valid entries for order amount and sales tax percent, with correct tax and order total results.

Total 50 100%

Required Software

Visual Studio 2012

Access the software at https://lab.devry.edu.

Steps: all

iLAB STEPS

Step 1: Launch Visual Studio and Create Project

Back to Top

(a) Log into the Citrix iLab site as you did in the previous labs. Click the Microsoft Visual Studio 2012 icon to launch Visual Studio.

(b) Pull down the File menu and select New Project . . .

(c) In the New Project dialog, ensure that under Templates in the left column, Visual Basic is selected, and that in the center column, Windows Form Application is selected. In the Name field at the bottom of the dialog, enter SalesTax. Click OK.

iLab 5: Step 1 Video

Watch the following video to see how to perform Step 1 of this week’s lab assignment.

Play00:00MuteFullscreen

Transcript

Step 2: Rename Form and Add Controls

Back to Top

(a) In the Solution Explorer pane on the right side of the screen, right-click on Form1.vb, select Rename, and change the name to SalesTax.vb. Press Enter after entering the new form name.

(b) Change the Text property of the form to Lab 5 Your Name (where Your Name = your full name), as you have done in previous labs.

(c) Drag the following controls from the ToolBox onto the form, arrange them in a logical fashion, and set their properties as indicated in the table below.

Control Name Property Text Property

Label Label1 Order amount:

TextBox txtOrderAmount

Label Label2 Sales tax percent:

TextBox txtSalesTaxPercent

Button btnCalcTotal Calculate Total Including Tax

ListBox lstMessages

(d) Ensure that all controls are positioned and sized so that the form has a neat, professional appearance and none of the text is cut off. Your completed form should look similar to the following.

A Windows form is shown with the title bar text reading “Lab 5 John Doe”. There are four rows of controls. In the first row, on the left is a label with text “Order amount:”, and on the right is an empty text box. In the second row, on the left is a label with text “Sales tax percent:”, and on the right is an empty text box. In the third row is a button with text “Calculate Total Including Tax”. In the fourth row is a list box named lstMessages.

iLab 5: Step 2 Video

Watch the following video to see how to perform Step 2 of this week’s lab assignment.

Play00:00MuteFullscreen

Transcript

Step 3: Code Button-Click Event and Validation Functions

Back to Top

(a) Double-click the button on the form to open the code editor with a template for the button-click event procedure.

(b) Starting where the cursor is positioned, in between the line Private Sub btnCalcTotal_Click(. . . and the line End Sub, enter the following code.

Button-Click Event Code

‘Declare variables

Dim decOrderAmount As Decimal

Dim decSalesTaxPercent As Decimal

Dim decTax As Decimal

Dim decOrderTotal As Decimal

Dim strOrderAmountMessage As String

Dim strSalesTaxPercentMessage As String

Dim blnInputsValid As Boolean = True

‘Clear messages

lstMessages.Items.Clear()

‘Validate order amount

strOrderAmountMessage = ValidateOrderAmount(txtOrderAmount.Text)

If strOrderAmountMessage <> “” Then

lstMessages.Items.Add(strOrderAmountMessage)

blnInputsValid = False

End If

‘Validate sales tax percent

strSalesTaxPercentMessage = ValidateSalesTaxPercent(txtSalesTaxPercent.Text)

If strSalesTaxPercentMessage <> “” Then

lstMessages.Items.Add(strSalesTaxPercentMessage)

blnInputsValid = False

End If

‘Perform processing if inputs are valid

If blnInputsValid = True Then

Decimal.TryParse(txtOrderAmount.Text, decOrderAmount)

Decimal.TryParse(txtSalesTaxPercent.Text, decSalesTaxPercent)

decTax = decOrderAmount * decSalesTaxPercent

decOrderTotal = decOrderAmount decTax

lstMessages.Items.Add(“The sales tax is ” & Format(decTax, “Currency”))

lstMessages.Items.Add(“The total including tax is ” & Format(decOrderTotal, “Currency”))

End If

(c) Position your cursor at the end of the End Sub line that closes the button-click event procedure. Press Enter twice to insert blank lines. At this position, below the End Sub for the button-click event procedure and above the End Class statement, enter the following code for the validation functions.

Validation Function Code

Function ValidateOrderAmount(strOrderAmount As String) As String

‘Validate order amount

Dim strOrderAmountMessage As String

If Not IsNumeric(strOrderAmount) Then

strOrderAmountMessage = “Please enter a numeric order amount.”

ElseIf Val(strOrderAmount) <= 0 Then

strOrderAmountMessage = “Please enter an order amount greater than zero.”

Else

strOrderAmountMessage = “”

End If

Return strOrderAmountMessage

End Function

Function ValidateSalesTaxPercent(strSalesTaxPercent As String) As String

‘Validate sales tax percent

Dim strSalesTaxPercentMessage As String

If Not IsNumeric(strSalesTaxPercent) Then

strSalesTaxPercentMessage = “Please enter a numeric sales tax percent.”

ElseIf Val(strSalesTaxPercent) < 0 Or Val(strSalesTaxPercent) > 0.14 Then

strSalesTaxPercentMessage = “Please enter a sales tax percent between 0.00 and 0.14.”

Else

strSalesTaxPercentMessage = “”

End If

Return strSalesTaxPercentMessage

End Function

(d) After entering all the code, your code editor window should look like this.

The Visual Basic code editor window is shown. The code for the button-click event handler is between the line beginning Private Sub btnCalcTotal_Click(. . . and the line End Sub. The code for the two validation functions is between the End Sub for the button-click event handler and the End Class line at the bottom of the window.

(e) Pull down the File menu and select Save All to save your work. If a Save Project dialog appears, ensure that the project is saved to the My DocumentsVisual Studio 2012Projects folder under your DSI number. Click Save.

iLab 5: Step 3 Video

Watch the following video to see how to perform Step 3 of this week’s lab assignment.

Play00:00MuteFullscreen

Transcript

Step 4: Test, Debug, and Submit

Back to Top

(a) Run the application by doing one of the following: click the Start button; pull down the Debug menu, and select Start Debugging; or press the F5 key.

(b) Your form should appear. Test your application by using the following test cases. For each test case, enter the indicated values for Order amount and Sales tax percent; click the Calculate Total Including Tax button; and check that the messages displayed in the list box are correct. Capture a screenshot showing the results of each correct test case and paste it into a Word document. Remember to use CTRL ALT PrintScreen to capture a screenshot.

Test case # Order amount Sales tax percent Messages

1 abc def

Please enter a numeric order amount.

Please enter a numeric sales tax percent.

2 -1 0.15

Please enter an order amount greater than 0.

Please enter a sales tax percent between 0 and 0.14.

3 100.00 0.10

The sales tax is $10.00.

The total including tax is $110.00.

As an example, the screenshot for Test Case 1 should look as follows.

The form for the application is shown. “abc” is entered in the text box for Order amount and “def” is entered in the text box for Sales tax percent. In the list box, the messages “Please enter a numeric order amount” and “Please enter a numeric sales tax percent” are displayed

(c) If your application does not work correctly, debug the application and try again. Post in the Q & A Forum or contact your professor for assistance, if needed.

(d) When your application works correctly for all test cases, select and copy all the code for the button-click event handler, the ValidateOrderAmount function, and the ValidateSalesTaxPercent function, and paste it into your Word document below the three test case screenshots. Save the Word document as Lab5YourFirstLastName.docx (where YourFirstLastName = your first and last name; e.g., JohnSmith) and submit it to the appropriate dropbox.

iLab 5: Step 4 Video

Watch the following video to see how to perform Step 4 of this week’s lab assignment.

Play00:00MuteFullscreen

Transcript

 

DeVry Courses helps in providing the best essay writing service. If you need 100% original papers for DeVry BIS 311 Week 5 iLab Latest, then contact us through call or live chat.

DeVry BIS 311 Week 5 iLab Latest

Best DeVry BIS 311 Week 5 iLab Latest

DeVry BIS 311 Week 5 iLab Latest