Follow us on Twitter!
Don't judge the unknown - Grindordie
Thursday, April 17, 2014
Navigation
Home
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
Learn
Communicate
Submit
Shop
Challenges
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Other
Members Online
Total Online: 24
Guests Online: 23
Members Online: 1

Registered Members: 82815
Newest Member: medjiking
Latest Articles
View Thread

HellBound Hackers | Computer General | Programming

Author

VB Mail order


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 18-10-10 05:04
I am trying to code this problem but kinda having a problem. here is what i have so far. Need some pointers if anyone can help. Also here is the problem.



'some way of creating prgram in a sup script. Match the weght and weight limit. It is worth while to



'Create a project that will calculate shipping charges from a two-dimensional table of rates. The rate depends on the weight

of the pakage and the zone to which
'it will be shipped. The weight column specfies the max weight for the rate. All weights over 10 pounds use the last row.


Code
Public Class Form1

    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim weight(,) As Decimal = {{1.0, 1.5, 1.65, 1.85}, {1.58, 2.0, 2.4, 3.05}, {1.71, 2.52, 3.1, 4.0}, {2.04, 3.12, 4.0, 5.01}, {2.52, 3.75, 5.1, 7.25}}
        Dim num1, num2 As Integer
        Dim results As Decimal
        For num1 = TextBox1.Text = 0 To 19
            For num2 = TextBox2.Text = 0 To 3
                If num1 < 3 Then
                    weight(1, num2) = True
                ElseIf num1 < 5 Then
                    weight(2, num2) = True
                ElseIf num1 < 10 Then
                    weight(3, num2) = True
                ElseIf num1 >= 10 Then
                    weight(4, num2) = True
                End If
            Next
        Next
        Label4.Text = results
    End Sub
End Class


Author

RE: VB Mail order

Mtutnid
Member

Your avatar

Posts: 102
Location: HELL
Joined: 22.09.10
Rank:
Newbie
Posted on 18-10-10 15:36
pigmanbear wrote:
I am trying to code this problem but kinda having a problem. here is what i have so far. Need some pointers if anyone can help. Also here is the problem.



'some way of creating prgram in a sup script. Match the weght and weight limit. It is worth while to



'Create a project that will calculate shipping charges from a two-dimensional table of rates. The rate depends on the weight

of the pakage and the zone to which
'it will be shipped. The weight column specfies the max weight for the rate. All weights over 10 pounds use the last row.




You have got the information. What do you want? What do you need help with? Do you want us to post a solution?
Author

RE: VB Mail order


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 18-10-10 16:16
Well i am stuck. All my output comes out to 0. It seems as if the information is not being gathered from the array. Not exactly sure. I am not trying to get an solution but some pointer or some feedback to help me out.
Author

RE: VB Mail order

Mtutnid
Member

Your avatar

Posts: 102
Location: HELL
Joined: 22.09.10
Rank:
Newbie
Posted on 18-10-10 16:22
pigmanbear wrote:
Well i am stuck. All my output comes out to 0. It seems as if the information is not being gathered from the array. Not exactly sure. I am not trying to get an solution but some pointer or some feedback to help me out.


Code
Label4.Text = results




If the output is in the label then it isn't that strange since you only defined the variable results without assigning ANY VALUE TO IT IN THE WHOLE CODE.

I don't know VB so I kinda can't help you much.

Edited by Mtutnid on 18-10-10 16:31
Author

RE: VB Mail order


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 18-10-10 16:34
So do you think i should assign num1 and num2 to something, and then that something will be assign to results?


Another question about the array. Can i assign a specific number to each row of line from the array. Because i do not want the user input to be starting from 0. So can i assign it so it will start at 1?
Author

RE: VB Mail order

Mtutnid
Member

Your avatar

Posts: 102
Location: HELL
Joined: 22.09.10
Rank:
Newbie
Posted on 18-10-10 17:11
pigmanbear wrote:
So do you think i should assign num1 and num2 to something, and then that something will be assign to results?


You should assign what your output has to be to the results before outputting it to the label or else the results will stay 0 for ever. Like in your code, the results does not get changed and then you try to assign nothing to a label which by default assumes that nothing is 0 and outputs 0.


Another question about the array. Can i assign a specific number to each row of line from the array. Because i do not want the user input to be starting from 0. So can i assign it so it will start at 1?


I don't think so. If you would be able to assign number 1 to row 0 and number 5 to row 1 it would get chaotic and slow down your compilation time or even program speed. I don't know if you can set a starting point at which it starts to count in VB, it varies from programming language to programming language if you can do that.
Author

RE: VB Mail order


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 18-10-10 19:51
You should assign what your output has to be to the results before outputting it to the label or else the results will stay 0 for ever. Like in your code, the results does not get changed and then you try to assign nothing to a label which by default assumes that nothing is 0 and outputs 0.


So kinda having a little problem with this. So i need to output num1 and num2 to results right?

How it is set up, is it gathering information from the array?
Author

RE: VB Mail order

Mtutnid
Member

Your avatar

Posts: 102
Location: HELL
Joined: 22.09.10
Rank:
Newbie
Posted on 19-10-10 12:55
Programming isn't for you. You have no logical thinking. Give up or stop wasting your time here and go and learn how to THINK.


Carve me up, slice me apart
Suck my guts and lick my heart
Chop me up, I like to be hurt
Drink my marrow and blood for dessert

My one desire, my only wish is to be-
EATEN...

Edited by Mtutnid on 19-10-10 12:56
Author

RE: VB Mail order


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 19-10-10 20:49
Mtutnid wrote:
Programming isn't for you. You have no logical thinking. Give up or stop wasting your time here and go and learn how to THINK.


Why would i give up when i am trying to learn. That is not how i work. I keep trying. If your not gonna help me then don't reply please, but if you do reply and help me out. That would be greatly appreciated

Public Class Form1

Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim weight(,) As Decimal = {{1.0, 1.5, 1.65, 1.85}, {1.58, 2.0, 2.4, 3.05}, {1.71, 2.52, 3.1, 4.0}, {2.04, 3.12, 4.0, 5.01}, {2.52, 3.75, 5.1, 7.25}}
Dim num1, num2 As Integer
Dim results As Decimal
For num1 = TextBox1.Text = 0 To 19
For num2 = TextBox2.Text = 0 To 3
If num1 < 3 Then
weight(1, num2) = True
ElseIf num1 < 5 Then
weight(2, num2) = True
ElseIf num1 < 10 Then
weight(3, num2) = True
ElseIf num1 >= 10 Then
weight(4, num2) = True
Weight(num1, num2) = results
Label4.Text = results
End If
Next
Next
End Sub
End Class.


I added the output to the results, but now it gives me an over flow.

http://i18.photobucket.com/albums/b106/grabit5000/omg.jpg
Author

RE: VB Mail order

GTADarkDude
Member



Posts: 142
Location: The Netherlands
Joined: 23.02.08
Rank:
Newbie
Posted on 19-10-10 21:05
Well I know shit about VB, but perhaps this helps:

- VB is case sensitive right? Why does "Weight(num1, num2) = results" start with a capital W?
- That line of code is strange anyway. You assign the value of the variable 'results' to some fixed array element? Shouldn't it be the other way around?
- Because 'results' is still empty then.
- num1 can contain values from 0 to 19. But your weight array contains only 5 elements. I guess this is why you get an IndexOutOfRangeException...
- In this nested for loop, you keep on changing Label4.Text, which is visible in some GUI I assume. Is this necessary? Because the user will probably only see the last one anyway.

Oh, and use the code-tags as you did on your previous post.

Good luck with this...


...
- - -
Author

RE: VB Mail order


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 19-10-10 21:20
Well I guess i am really lost. If someone could code a snippet on how exactly it should look that would be great. It seems as if i got the wrong concept of this.
Author

RE: VB Mail order


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 20-10-10 04:21
The problem with your script is that you're not understanding the concept of assignment in programming.

1. Read this until you understand it: http://msdn.microsoft.com/en-us/library/cd6hcy37%28VS.80%29.aspx
2. Read your code. Read it again.
3. You're trying to set the label text to show the variable called results, so set results equal to something instead of setting weight() equal to true or some other nonsense.
4. You don't need "For" loops. You're using them to assign num1 and num2, but you can assign them without it.
5. Re-read 3 and 4 until you get the meaning of each, then fix them.

You don't need someone to create a "snippet" for you. You need to learn, and you need to be taught. So, get to work.


Author

RE: VB Mail order


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 20-10-10 07:59
define wrote:
The problem with your script is that you're not understanding the concept of assignment in programming.

1. Read this until you understand it: http://msdn.microsoft.com/en-us/library/cd6hcy37%28VS.80%29.aspx
2. Read your code. Read it again.
3. You're trying to set the label text to show the variable called results, so set results equal to something instead of setting weight() equal to true or some other nonsense.
4. You don't need "For" loops. You're using them to assign num1 and num2, but you can assign them without it.
5. Re-read 3 and 4 until you get the meaning of each, then fix them.

You don't need someone to create a "snippet" for you. You need to learn, and you need to be taught. So, get to work.




Code
Public Class Form1

Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim weight(,) As Decimal = {{1.0, 1.5, 1.65, 1.85}, {1.58, 2.0, 2.4, 3.05}, {1.71, 2.52, 3.1, 4.0}, {2.04, 3.12, 4.0, 5.01}, {2.52, 3.75, 5.1, 7.25}}
Dim num1, num2 As Integer
Dim results As Decimal
For num1 = TextBox1.Text
For num2 = TextBox2.Text
If num1 < 3 Then
weight(1, num2) = True
ElseIf num1 < 5 Then
weight(2, num2) = True
ElseIf num1 < 10 Then
weight(3, num2) = True
ElseIf num1 >= 10 Then
weight(4, num2) = True
results = weight(num1,  num2)
Label4.Text = results
End If
End Sub
End Class





I assigned results to weight and the array, but now i don't get any output. I am not sure if my code is even coded right. What am i doing wrong?
Author

RE: VB Mail order

AldarHawk
Member



Posts: 1690
Location: Canada
Joined: 26.01.06
Rank:
Hacker Level 1
Posted on 21-10-10 12:18
pigmanbear, all I can do is shake my head.

READ YOUR CODE!

You will then notice your error. If you do not, programming is not your line of work. Read some books if you do not understand this issue. I will give you a hint...it is in your results!


Just ask Yahoo!Taboo! http://www.erikwestlake.com