Placeholder

BIS 311 DeVry Week 6 iLab

$24.00

Quantity:

Product Description

BIS 311 DeVry Week 6 iLab

BIS311

BIS 311 DeVry Week 6 iLab

iLAB OVERVIEW

Scenario/Summary

For this lab, you’ll create an application that is, in many ways, similar to the sales tax calculator you built last week. What is different this week is not what the application does, but how it does it. You will create an Order class to represent the order, with properties to hold the order amount and the sales tax percent values, and a method to calculate the order total. You will also create a user interface to get the input values from the user, instantiate an object of the Order class, call its calculation method to determine the order total, and display the total to the user.

Order Calculator Application Business Requirements

The user enters an order amount and a sales tax percent. If the order amount is greater than $100, a discount of 10% will be applied to the order amount. If the order amount is less than or equal to $100, no discount is applied. The sales tax is calculated by multiplying the order amount (after discount, if applicable) by the sales tax percent. The order total is calculated by adding the order amount (after discount, if applicable) to the sales tax. The order total is displayed as output to the user.

TOE Chart for Order Calculator Application User Interface

Task Object Event
Get the following inputs from the user:
Order amount txtOrderAmount
Sales tax percent txtSalesTaxPercent
Perform the following processing:
Calculate order total after discount with tax btnCalcTotal Click
currentOrder
Display the following outputs:
Order total lblTotal

Notice that the TOE chart lists a currentOrder object as being involved with the processing, in addition to the usual button. Also notice that the details of how to perform the order total calculation are not listed on this TOE chart. This is because the details of how to perform the calculation will be handled by the currentOrder object, so the application’s user interface does not need to be concerned with how this is done. The details of the calculation are encapsulated within the object.

Pseudocode for Order Calculator Application User Interface

Start button-click event handler

Instantiate currentOrder object from Order class

Get from user

OrderAmount property of currentOrder

SalesTaxPercent property of currentOrder

Display result of GetTotalAfterDiscount() method of currentOrder to user

Stop button-click event handler

Class Diagram for Order Class

Order

+numeric OrderAmount

+numeric SalesTaxPercent

GetTotalAfterDiscount()

Pseudocode for GetTotalAfterDiscount() Method of Order Class

Numeric GetTotalAfterDiscount()

Declare numeric variables for

Discount

TotalAfterDiscount

If OrderAmount > 100

Discount=0.10

Else

Discount=0

TotalAfterDiscount = (OrderAmount – OrderAmount * Discount) * (1 + SalesTaxPercent)

Return TotalAfterDiscount

End GetTotalAfterDiscount()

Deliverables

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

  • Screenshot of form showing the application running, with order amount less than or equal to $100 and valid sales tax percent entered, and correct order total displayed
  • Screenshot of form showing the application running, with order amount greater than $100 and valid sales tax percent entered, and correct order total displayed
  • Copy of code for button-click event
  • Copy of code for Order class

Category

Category Points % Description
Create and rename form 5 10% Windows form was created and named OrderCalculator.vb. Form text property was set to Lab 6 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 order total; and label for display of 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 10 20% Button-click event code was entered that corresponds to the given pseudocode, with no syntax errors.
Code Order class 10 20% Code for Order class was entered that corresponds to the given class diagram and pseudocode, with no syntax errors. Class includes the OrderAmount property, the SalesTaxPercent property, and the GetTotalAfterDiscount() method.
Test-run application successfully 15 30% Application is shown running successfully with screenshots for each of the two test cases: (1) order amount less than or equal to $100; and (2) order amount greater than $100. In each case, the correct result for the order total should be displayed.
Total 50 100%

Required Software

Visual Studio 2012

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

Steps: all

iLAB STEPS

Step 1: Launch Visual Studio and Create Project

.equella.ecollege.com/file/3450b195-384a-4922-a92c-c1c916ce1bb1/37/BIS311_W6_iLab.html#top”>Back to Top

(a) Log in to 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 OrderCalculator. Click OK.

Step 2: Rename Form and Add Controls

.equella.ecollege.com/file/3450b195-384a-4922-a92c-c1c916ce1bb1/37/BIS311_W6_iLab.html#top”>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 OrderCalculator.vb. Press Enter after entering the new form name.

(b) Change the Text property of the form to Lab 6 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 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

.equella.ecollege.com/file/3450b195-384a-4922-a92c-c1c916ce1bb1/37/BIS311_W6_iLab.html#top”>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

.equella.ecollege.com/file/3450b195-384a-4922-a92c-c1c916ce1bb1/37/BIS311_W6_iLab.html#top”>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

.equella.ecollege.com/file/3450b195-384a-4922-a92c-c1c916ce1bb1/37/BIS311_W6_iLab.html#top”>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.