| View previous topic :: View next topic |
| Author |
Message |
Saucy. How do I cheat?
Reputation: 42
Joined: 19 May 2010 Posts: 0
|
Posted: Thu Jan 27, 2011 11:59 pm Post subject: |
|
|
| Shrooms wrote: | | Code: | Module Furniture
Sub Main()
Dim minimum As Double = 150.0
Dim length As Double
Dim width As Double
Dim surface As Double
Dim overSurface As Double
Dim overSurfaceDetermine As Double = 750.0
Dim overSurfaceCharge As Double = 50.0
Dim overSurfaceNoCharge As Double = 0.0
Dim woodChoice As String
Dim mahogany As Double = 200.0
Dim oak As Double = 100.0
Dim pine As Double = 0.0
Dim leaf As Integer
Dim leafcost As Double = 50.0
Dim three As String
three = ""
Dim two As String
two = ""
Dim one As String
one = ""
Dim woodCost As Double
Dim endTotal As Double
Dim leafTotal As Double
length = InputBox$("Enter length: ")
'get length
width = InputBox$("Enter width: ")
'get width
surface = width * length
If (surface > overSurfaceDetermine) Then overSurface = overSurfaceCharge Else overSurface = overSurfaceNoCharge
woodChoice = InputBox$("Enter your choice of wood; one for Pine, two for Oak, three for Mahogany: ")
'get woodChoice
If (woodChoice = three) Then woodCost = mahogany Else If (woodChoice = two) Then woodCost = oak Else If (woodChoice = one) Then woodCost = pine
leaf = InputBox$("Number of leaves: ")
'get leaf
leafTotal = leaf * leafcost
endTotal = leafTotal + woodCost + overSurface
System.Console.WriteLine("The charge for this table is $" & endTotal)
End Sub
End Module |
Still doing without a vb vs LOL. All in head. |
I use nothing but Notepad++ and the little help my professor gives online.
Also, it worked, fucking love you.
|
|
| Back to top |
|
 |
Saucy. How do I cheat?
Reputation: 42
Joined: 19 May 2010 Posts: 0
|
Posted: Fri Jan 28, 2011 12:28 am Post subject: |
|
|
| Shrooms wrote: | | Saucy Balmung wrote: | | Shrooms wrote: | | Code: | Module Furniture
Sub Main()
Dim minimum As Double = 150.0
Dim length As Double
Dim width As Double
Dim surface As Double
Dim overSurface As Double
Dim overSurfaceDetermine As Double = 750.0
Dim overSurfaceCharge As Double = 50.0
Dim overSurfaceNoCharge As Double = 0.0
Dim woodChoice As String
Dim mahogany As Double = 200.0
Dim oak As Double = 100.0
Dim pine As Double = 0.0
Dim leaf As Integer
Dim leafcost As Double = 50.0
Dim three As String
three = ""
Dim two As String
two = ""
Dim one As String
one = ""
Dim woodCost As Double
Dim endTotal As Double
Dim leafTotal As Double
length = InputBox$("Enter length: ")
'get length
width = InputBox$("Enter width: ")
'get width
surface = width * length
If (surface > overSurfaceDetermine) Then overSurface = overSurfaceCharge Else overSurface = overSurfaceNoCharge
woodChoice = InputBox$("Enter your choice of wood; one for Pine, two for Oak, three for Mahogany: ")
'get woodChoice
If (woodChoice = three) Then woodCost = mahogany Else If (woodChoice = two) Then woodCost = oak Else If (woodChoice = one) Then woodCost = pine
leaf = InputBox$("Number of leaves: ")
'get leaf
leafTotal = leaf * leafcost
endTotal = leafTotal + woodCost + overSurface
System.Console.WriteLine("The charge for this table is $" & endTotal)
End Sub
End Module |
Still doing without a vb vs LOL. All in head. |
I use nothing but Notepad++ and the little help my professor gives online.
Also, it worked, fucking love you. |
This is why I got really good in my recent java course.
And to everyone else, surprised you said "delete end ifs"..... :roll:
JAVA SYNTEX = VB SYNTEX with a few differences. |
Turns out there's a problem with that.
It always reads the woodCost as Pine, regardless of what the user enters. :l
|
|
| Back to top |
|
 |
Mychilli Grandmaster Cheater Supreme
Reputation: 3
Joined: 19 Jun 2006 Posts: 1141
|
|
| Back to top |
|
 |
Saucy. How do I cheat?
Reputation: 42
Joined: 19 May 2010 Posts: 0
|
Posted: Fri Jan 28, 2011 12:44 am Post subject: |
|
|
No luck, thanks guys, just turning what I have, I've spent far too much on this, I'll still get some points.. three more labs to go, and four long codes to debug before Noon.. and I'll need some sleep too.
Thanks again for trying to help.
|
|
| Back to top |
|
 |
Mychilli Grandmaster Cheater Supreme
Reputation: 3
Joined: 19 Jun 2006 Posts: 1141
|
Posted: Fri Jan 28, 2011 12:46 am Post subject: |
|
|
| i just told u how to do it B|
|
|
| Back to top |
|
 |
gogodr I post too much
Reputation: 125
Joined: 19 Dec 2006 Posts: 2041
|
Posted: Fri Jan 28, 2011 1:03 am Post subject: |
|
|
did you try adding new lines and closing your IF conditions in ()'s ?
edit:: too late I guess xP
|
|
| Back to top |
|
 |
Saucy. How do I cheat?
Reputation: 42
Joined: 19 May 2010 Posts: 0
|
Posted: Fri Jan 28, 2011 1:13 am Post subject: |
|
|
Haven't sent yet, if you think you can help, Gogo.
Shrooms, it still doesn't work, you were colder that time. ;-;
|
|
| Back to top |
|
 |
gogodr I post too much
Reputation: 125
Joined: 19 Dec 2006 Posts: 2041
|
Posted: Fri Jan 28, 2011 1:30 am Post subject: |
|
|
try this?
| Code: | Module Furniture
Sub Main()
dim minimum as double = 150.00
dim length as double
dim width as double
dim surface as double
dim overSurface as double
dim overSurfaceDetermine as double = 750.00
dim overSurfaceCharge as double = 50.00
dim overSurfaceNoCharge as double = 0.00
dim woodChoice as string
dim mahogany as double = 200.00
dim oak as double = 100.00
dim pine as double = 0.00
dim leaf as integer
dim leafcost as double = 50.00
dim three as string
dim two as string
dim one as string
dim woodCost as double
dim endTotal as double
dim leafTotal as double
length = InputBox$("Enter length: ")
'get length
width = InputBox$("Enter width: ")
'get width
surface = width * length
woodChoice = InputBox$("Enter your choice of wood; one for Pine, two for Oak, three for Mahogany: ")
'get woodChoice
leaf = InputBox$("Number of leaves: ")
'get leaf
if (surface > overSurfaceDetermine) then
overSurface = overSurfaceCharge
else overSurface = overSurfaceNoCharge
end if
if (woodChoice = three) then
woodCost = mahogany
elseif (woodChoice = two) then
woodCost = oak
elseif (woodChoice = one) then
woodCost = pine
end if
leafTotal = leaf * leafCost
endTotal = leafTotal + woodCost + overSurface
System.Console.WriteLine("The charge for this table is $" & endTotal)
End Sub
End Module |
|
|
| Back to top |
|
 |
Saucy. How do I cheat?
Reputation: 42
Joined: 19 May 2010 Posts: 0
|
Posted: Fri Jan 28, 2011 1:38 am Post subject: |
|
|
| Disregard this, all of you who tried to help, I owe you a bunch.
|
|
| Back to top |
|
 |
gogodr I post too much
Reputation: 125
Joined: 19 Dec 2006 Posts: 2041
|
Posted: Fri Jan 28, 2011 11:13 am Post subject: |
|
|
| Shrooms wrote: | | gogodr wrote: | try this?
| Code: | Module Furniture
Sub Main()
dim minimum as double = 150.00
dim length as double
dim width as double
dim surface as double
dim overSurface as double
dim overSurfaceDetermine as double = 750.00
dim overSurfaceCharge as double = 50.00
dim overSurfaceNoCharge as double = 0.00
dim woodChoice as string
dim mahogany as double = 200.00
dim oak as double = 100.00
dim pine as double = 0.00
dim leaf as integer
dim leafcost as double = 50.00
dim three as string
dim two as string
dim one as string
dim woodCost as double
dim endTotal as double
dim leafTotal as double
length = InputBox$("Enter length: ")
'get length
width = InputBox$("Enter width: ")
'get width
surface = width * length
woodChoice = InputBox$("Enter your choice of wood; one for Pine, two for Oak, three for Mahogany: ")
'get woodChoice
leaf = InputBox$("Number of leaves: ")
'get leaf
if (surface > overSurfaceDetermine) then
overSurface = overSurfaceCharge
else overSurface = overSurfaceNoCharge
end if
if (woodChoice = three) then
woodCost = mahogany
elseif (woodChoice = two) then
woodCost = oak
elseif (woodChoice = one) then
woodCost = pine
end if
leafTotal = leaf * leafCost
endTotal = leafTotal + woodCost + overSurface
System.Console.WriteLine("The charge for this table is $" & endTotal)
End Sub
End Module |
|
Yours won't work...  |
nor does yours
"Shrooms, it still doesn't work, you were colder that time. ;-;"
_________
BTW: mine does work. I just tested it in Excel.
| Code: | Sub main()
Dim minimum As Double
Dim length As Double
Dim width As Double
Dim surface As Double
Dim overSurface As Double
Dim overSurfaceDetermine As Double
Dim overSurfaceCharge As Double
Dim overSurfaceNoCharge As Double
Dim woodChoice As String
Dim mahogany As Double
Dim oak As Double
Dim pine As Double
Dim leaf As Integer
Dim leafcost As Double
Dim three As String
Dim two As String
Dim one As String
Dim woodCost As Double
Dim endTotal As Double
Dim leafTotal As Double
minimum = 150
overSurface = 750
overSurfaceCharge = 50
overSurfaceNoCharge = 0
mahogany = 200
oak = 100
pine = 0
leaftcost = 50
length = InputBox$("Enter length: ")
'get length
width = InputBox$("Enter width: ")
'get width
surface = width * length
woodChoice = InputBox$("Enter your choice of wood; one for Pine, two for Oak, three for Mahogany: ")
'get woodChoice
leaf = InputBox$("Number of leaves: ")
'get leaf
If (surface > overSurfaceDetermine) Then
overSurface = overSurfaceCharge
Else: overSurface = overSurfaceNoCharge
End If
If (woodChoice = three) Then
woodCost = mahogany
ElseIf (woodChoice = two) Then
woodCost = oak
ElseIf (woodChoice = one) Then
woodCost = pine
End If
leafTotal = leaf * leafcost
endTotal = leafTotal + woodCost + overSurface
Sheet4.Cells(1, 1) = "The charge for this table is $" & endTotal
'System.Console.WriteLine ("The charge for this table is $" & endTotal)
End Sub |
|
|
| Back to top |
|
 |
Jesper Grandmaster Cheater Supreme
Reputation: 9
Joined: 21 Feb 2007 Posts: 1156
|
Posted: Fri Jan 28, 2011 11:35 am Post subject: |
|
|
| You forgot the trailing Then after the if statements.
|
|
| Back to top |
|
 |
gogodr I post too much
Reputation: 125
Joined: 19 Dec 2006 Posts: 2041
|
Posted: Fri Jan 28, 2011 12:30 pm Post subject: |
|
|
you need the last else otherwise if someone inputs "bullshit" it would still mean pine :/
and mine works perfectly too :3
|
|
| Back to top |
|
 |
|