Shipping program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jinxzzz
    New Member
    • Sep 2015
    • 2

    Shipping program

    Hello guys, I'm looking for help on writing this program. I need to calculate the shipping cost of an item depending on the wight the user inputs.

    I have done the program as a console application already and it works, however, the assignment calls for a WPF and I'm not sure what else I need to do here.

    This is what I have so far for the WPF

    weight = user input
    label 4 is the message being displayed

    The code is only reading the first line in the if...elseif regardless of what I input on the weight text box on the form and I'm not really sure how I should go to fix that. Any help is appreciated.

    Code:
     Dim price As Double
     Dim weight As Double
    
    
            If weight < 1 Then
                price = 2.5
            ElseIf weight >= 1 And weight < 5 Then
                price = 10
            ElseIf weight >= 5 And weight < 10 Then
                price = 15
            ElseIf weight = 10 Then
                price = 16
            End If
    
    
    
            label4.Text = ("The shipping cost will be $" & price)
  • HIP318
    New Member
    • Sep 2015
    • 2

    #2
    If weight < 1 Then price = 2.5
    If weight >= 1 And weight < 5 Then price = 10
    If weight >= 5 And weight < 10 Then price = 15
    If weight >= 10 Then price = 16

    Comment

    • jinxzzz
      New Member
      • Sep 2015
      • 2

      #3
      Thanks for the reply, but the if...if else statements weren't the problem. I figured it out though. So again, thanks for the reply.

      Comment

      Working...