Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27365

Novelty Warehouse Solution

$
0
0
Hey everyone,

First I'd like to say that I am pretty new to Visual Basic. I am trying to learn how to code/program all sorts of stuff since I've always found it interesting. Anyways, I have the Microsoft Visual Basic 2010 Reloaded 4th Edition Book and its safe to say that I am pretty much at a loss with how to do some stuff. Right now I am working on Chapter 4 "Novelty Warehouse Solution" and I am having a bit of an issue since debugging the program and testing it doesn't give the desired result(Maybe because I missed something).

Novelty Warehouse solution wants: Novelty Warehouse needs an application that allows the user to enter an item’s price. When the user clicks a button in the interface, the buttons Click event procedure should add the price to the total of the prices already entered; this amount represents the subtotal owed by the customer. e application should display the subtotal on the screen. It also should display a 3% sales tax, the shipping charge, and the grand total owed by the customer. e 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 price and then clicks the button, the buttons Click event procedure should display 26.75 as the subtotal, .80 as the sales tax, 15.00 as the shipping charge, and 42.55 as the grand total. If the user subsequently enters 30.00 as the price and then clicks the button, the buttons 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 (zero). Name the solution, project, and form fi le Novelty Solution, Novelty Project, and Main Form.vb, respectively. Save the solution in the VbReloaded2010\Chap04 folder. You can create either your own user interface or the one shown in Figure 4

This is the code I have so far:

Code:
Quote:

'Project name: Novelty Solution
'Project Purpose: Calculates the item price and gives
' The subtotal, sales tax, shipping,
' And total information
'Created by:
'Created/Modified: 3/16/2013

Option Explicit On
Option Strict On
Option Infer Off

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

Private Sub CalButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles calButton.Click
Dim Price As Double
Dim ship As Double
Dim totaldue As Double
Dim subtotal As Double
Dim tax As Double
Dim subdue As Double


Double.TryParse(TextBox1.Text, subtotal)

subtotal = subtotal + Price

If subtotal > 100 Then
ship = 0
Else
ship = 15

End If
tax = 0.03 * subdue
TextBox1.Text = CStr(subdue)
salestaxLabel.Text = CStr(tax)
shippingLabel.Text = CStr(ship)
totaldue = subdue + tax + ship
totaldueLabel.Text = CStr(totaldue)
End Sub

Private Sub exitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles exitButton.Click
Me.Close()
End Sub
End Class
Any help on how to reach a fix on the program will be greatly appreciated and I thank you in advance for the feedback!

Best,

Viewing all articles
Browse latest Browse all 27365

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>