Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a Visual Basic Windows application. Use the following names for the solut

ID: 3674221 • Letter: C

Question

Create a Visual Basic Windows application. Use the following names for the solution, project, and form file, respectively: Novelty Solution, Novelty Project, and Main Form.vb. Save the application in the VB2010Chap04 folder. Create the interface shown in the figure 4-65. When the user clicks the Calculate Total button, the button's Click event procedure should add the item price to the total of the prices already entered; this amount represents the subtotal owed by the customer. The procedure should display the subtotal on the form. It also should display a 3% sales tax, the shipping charge, and the grand total owed by the customer. The grand total is calculated by adding together the subtotal, the 3% sales tax, and a $15 shipping charge. For example, if the user enters 26.75 as the item price and then clicks the Calculate Total button, the button's Click event procedure should display 26.75 as the subtotal, 0.80 as the sales tax, 15.00 as the shipping charge, and 42.55 as the grand total. If the user subsequently enters 30 as the price and then clicks the Calculate Total button, the button's Click event procedure should display 56.75 as the subtotal, 1.70 as the sales tax, 15.00 as the shipping charge, and 73.45 as the grand total. However, when the subtotal is at least $100, the shipping charge is 0.00. Code the application. Save the solution and then start and test the application. Close the code editor window and then close the solution.

Explanation / Answer

'Note: Place the following event in proper place in your program

'You can change the name of the text boxes as per your need

Private Sub CalculateTotalBtn_Click()
Dim subTotal As Double
Dim grandTotal As Double
Dim salesTax As Double
Dim ShippingCost As Double
'ItemPrice will be subTotal
subTotal=val(ItemPriceTxt.Text)
'display subTotal
SubTotalTxt.Text=subTotal
'calculate salesTax as 3% of subTotal
salesTax=subTotal*0.03
'display salesTax
SalesTaxTxt.Text=salesTax
' decide shipping cost based on subTotal
   If subTotal>=100 Then
   ShippingCost=0
Else
ShippingCost=15
   'display shipping cost
ShippingTxt.Text=ShippingCost
'calculating grand total
grandTotal=subTotal+salesTax+ShippingCost
'display grandTotal
TotalDueTxt.Text=grandTotal
End Sub