11 months ago

BIS 311 DeVry Week 6 iLab

Label Label1 Order

Label Label1 Order amount: TextBox txtOrderAmount Label Label2 Sales tax percent: TextBox txtSalesTaxPercent Button btnCalcTotal Calculate Order Total Label lblTotal Order total will display here (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 like the following. Step 3: Code Order Class">Back to Top (a) Pull down the Project menu, select Add Class, and add a new class file named Order.vb to your project. (b) Starting where the cursor is positioned, in between the Public Class Order and the End Class statements, enter the following code. Order Class Code 'This class represents an order Public OrderAmount As Decimal Public SalesTaxPercent As Decimal Public Function GetTotalAfterDiscount() As Decimal 'Calculate the order total including tax and discount if applicable Dim decTotalAfterDiscount As Decimal Dim decDiscount As Decimal If OrderAmount > 100 Then decDiscount =0.10 Else decDiscount =0 EndIf decTotalAfterDiscount = (OrderAmount - OrderAmount * decDiscount) * (1 + SalesTaxPercent) Return decTotalAfterDiscount End Function (c) After entering all the code, your code editor window should look like this. (d) Pull down the File menu and select Save All to save your work so far. 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. Step 4: Code Button-Click Event">Back to Top (a) Click the .OrderCalculator.vb [Design] tab at the top of code editor window to return to the form. (b) Double-click the button on the form to open the code editor with a template for the button-click event procedure. (c) 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 'Calculate and display order total Dim currentOrder As New Order Decimal.TryParse(txtOrderAmount.Text, currentOrder.OrderAmount) Decimal.TryParse(txtSalesTaxPercent.Text, currentOrder.SalesTaxPercent) lblTotal.Text = "The order total is " & Format(currentOrder.GetTotalAfterDiscount(), "Currency") (d) After entering all the code, your code editor window should look like this. Step 5: 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 entering the following test cases. For each test case, enter the indicated values for Order amount and Sales tax percent; click the Calculate Order Total button; and check that the result displayed is correct. Capture a screenshot of each correct test case and paste them into a Word document. Remember, use CTRL+ALT+PrintScreen to capture a screenshot. Test case # Order amount Sales tax percent Order total 1 99 0.10 $108.90 2 150 0.10 $148.50 As an example, your screenshot for test case #1 should look like the following. (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 and the Order class and paste it into your Word document below the test case screenshots. Save the Word document as Lab6YourFirstLastName.docx (where YourFirstLastName = your first and last name, e.g. JohnSmith) and submit it to the appropriate dropbox.

DEVRY CIS 336 Week 6 iLab 6
DEVRY MGMT 404 Week 6 iLab