Share on facebook
Share on google
Share on twitter
Share on linkedin



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




Get the following inputs from the user:

Order amount


Sales tax percent


Perform the following processing:

Calculate order total after discount with tax




Display the following outputs:

Order total


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


+numeric OrderAmount

+numeric SalesTaxPercent


Pseudocode for GetTotalAfterDiscount() Method of Order Class

Numeric GetTotalAfterDiscount()

Declare numeric variables for



If OrderAmount > 100




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

Return TotalAfterDiscount

End GetTotalAfterDiscount()


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






Create and rename form



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



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



Name and text properties of all controls were set appropriately, with no typos or spelling errors.

Code button-click event



Button-click event code was entered that corresponds to the given pseudocode, with no syntax errors.

Code Order class



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



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.




Required Software

Visual Studio 2012

Access the software at”>
Steps: all


Step 1: Launch Visual Studio and Create Project”>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”>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 toOrderCalculator.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.


Name Property

Text Property



Order amount:





Sales tax percent:





Calculate Order Total



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


decDiscount =0


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









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 (whereYourFirstLastName = your first and last name, e.g. JohnSmith) and submit it to the appropriate dropbox.

More to explorer

New Union Conceptualization

Module 7 Discussion  New Union Conceptualization After all that we have read and explored, a new conception of unions may be needed.

Statistical Process Control

For the process you chose in 1-3, identify the type (variable or attribute) of data you have collected for the outputs of

Statement Of Purpose

Statement of Purpose – A document of no more than two pages outlining your objectives for pursuing a Masters of Science in Information


Title: devry-bis311-week-6-ilab

This question has been Solved!

Click the button below to order this solution.

Leave a Reply

Your email address will not be published. Required fields are marked *

Open chat