Edit: Solved..
[College - Computer Science] Programming in VB(Drag and Drop)
Collapse
This topic is closed.
X
X
-
Re: [College - Computer Science] Programming in VB(Drag and Drop)
your university things Java -> WPF is a good progression? lol
especially if it's not say Java -> Swing in Java -> WPFPatashu makes Chiptunes in Famitracker:
http://soundcloud.com/patashu/8bit-progressive-metal-fading-world
http://img.photobucket.com/albums/v216/Mechadragon/smallpackbanner.png
Best non-AAAs: ERx8 v2 (14-1-0-4), Hajnal (3-0-0-0), RunnyMorning (8-0-0-4), Xeno-Flow (1-0-0-3), Blue Rose (35-2-0-20), Ketsarku (14-0-0-0), Silence (1-0-0-0), Lolo (14-1-0-1)
http://i231.photobucket.com/albums/ee301/xiaoven/solorulzsig.png -
-
Re: [College - Computer Science] Programming in VB(Drag and Drop)
Well, I might as well post this in this thread since it's concerning VB. I have a project due Friday and I'm supposed to create a coin calculator where someone enters in an amount of change in a textbox and on a button click it determines how many quarters, dimes, nickels, and pennies it takes to make the change.
My issue is that no errors show up in the error list, but when I test it, it just crashes and doesn't give me a clear solution at all.
Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click
Dim Change As Double
Dim Quarter, Dime, Nickel, Penny As Integer
Change = CDbl(txtChange.Text)
Quarter = CInt(txtQuarter.Text)
Dime = CInt(txtDime.Text)
Nickel = CInt(txtNickel.Text)
Penny = CInt(txtPenny.Text)
Quarter = CInt(Change / 0.25)
Dime = CInt(Change Mod 0.25 / 10)
Nickel = CInt(Change Mod 0.1 / 5)
Penny = CInt(Change Mod 0.05 / 1)
End Sub
End Class
I'm VERY new at this, so be kind haha. You don't have to give me a solution, just a hint is nice. The bold line is where it finds an issue.
EDIT: This is the error I get: Conversion from string "" to type 'Double' is not valid. (or similar things)Last edited by customstuff; 10-2-2012, 04:00 PM.
Originally posted by MrMagic5239Placements are final, custom will not be moved to D6, just because he is good at jacks, and mediocre at just about every other FMO in the game.Originally posted by customstuffOriginally posted by MrMagic5239welcome to D6
start playingComment
-
Re: [College - Computer Science] Programming in VB(Drag and Drop)
Here is a hint in the form of a question: How can you represent an empty string as an integer?
YOUR THROBBING MULTIFARIOUS LUSTFUL DESIRES ARE COMPLETED N YOUR HYPER-ORANGE SELF, YOU MAKE ME LOVE AGAIN, YOU'VE CHANGED MY HEART, MY MELANCHOLIA DISAPPEARS WHEN YOU ARE INSIDE OF ME, MY HUMAN RAGE IS TEMPERED WHEN I AM INSIDE YOU, THE SECRET IS COMMUNICATION, LONGEVITY, STAMINA, REPETITION, FURY, SOULFUL KISSING, EARPLUGS. YOU FUCKING CORPORATE COCKS AND CUNTS.
MY ANXIETY COMPLETE, MY DESIRE REPLETE, THE TASTE OF ORANGE BLOOD AND CUM AND GREENBACKS RUNNING DOWN MY FACE. THE STREETS WILL RUN ORANGE WITH YOUR MIXTURE OF CHEETOS AND HUNDRED DOLLAR BILLS REGURGITATED AND EATEN AND SHIT OUT AGAIN AND EATEN AGAIN.
YOU ARE MY SCULPTURE, MY SCULPTRA, MY SELF-DEFINITION. MY DEFINITION OF HUMANITY, MY HARMONY. MY HEART AND MY MIND.
YOU ARE SO ORANGE. SO CRUNCHY. SO CONSUMABLE.
THE NEW ORANGE UNDERGROUND IS THE ORANGE UP MY ASS. AND YOUR ASS.
I LOVE YOU CHEETOS.
Comment
-
Re: [College - Computer Science] Programming in VB(Drag and Drop)
I went ahead before I saw your hint and got this, however there's still some issues.
Dim Change As Long
Dim Quarter, Dime, Nickel, Penny As Integer
Change = CLng(txtChange.Text) * 100
Quarter = CInt(Change / 25)
txtQuarter.Text = CStr(Quarter)
Dime = CInt(Change Mod 25 / 10)
txtDime.Text = CStr(Dime)
Nickel = CInt(Change Mod 1 / 5)
txtNickel.Text = CStr(Nickel)
Penny = CInt(Change Mod 5 / 1)
txtPenny.Text = CStr(Penny)
I've been trying to change from Long to Double and everything, so this has been changing a lot but whatever I do, it doesn't show accurate numbers. It said I needed 4 quarters for $0.94 and 0 for $0.50.Last edited by customstuff; 10-2-2012, 05:40 PM.
Originally posted by MrMagic5239Placements are final, custom will not be moved to D6, just because he is good at jacks, and mediocre at just about every other FMO in the game.Originally posted by customstuffOriginally posted by MrMagic5239welcome to D6
start playingComment
-
Re: [College - Computer Science] Programming in VB(Drag and Drop)
Your math is incorrect.
Let's assume for a moment that you have $0.99 in change and you want to find out what the correct amount of each coin type is.
In this case you should be dealing in integers, since they don't have rounding errors. $0.99 multiplied by 100 is 99, so now you can start manipulating that figure.
When you divide 99 by 25 in integer arithmetic, the quotient is 3 because everything after the decimal is truncated, so you know you need 3 quarters.
You should be able to correct the rest of your program from here.
YOUR THROBBING MULTIFARIOUS LUSTFUL DESIRES ARE COMPLETED N YOUR HYPER-ORANGE SELF, YOU MAKE ME LOVE AGAIN, YOU'VE CHANGED MY HEART, MY MELANCHOLIA DISAPPEARS WHEN YOU ARE INSIDE OF ME, MY HUMAN RAGE IS TEMPERED WHEN I AM INSIDE YOU, THE SECRET IS COMMUNICATION, LONGEVITY, STAMINA, REPETITION, FURY, SOULFUL KISSING, EARPLUGS. YOU FUCKING CORPORATE COCKS AND CUNTS.
MY ANXIETY COMPLETE, MY DESIRE REPLETE, THE TASTE OF ORANGE BLOOD AND CUM AND GREENBACKS RUNNING DOWN MY FACE. THE STREETS WILL RUN ORANGE WITH YOUR MIXTURE OF CHEETOS AND HUNDRED DOLLAR BILLS REGURGITATED AND EATEN AND SHIT OUT AGAIN AND EATEN AGAIN.
YOU ARE MY SCULPTURE, MY SCULPTRA, MY SELF-DEFINITION. MY DEFINITION OF HUMANITY, MY HARMONY. MY HEART AND MY MIND.
YOU ARE SO ORANGE. SO CRUNCHY. SO CONSUMABLE.
THE NEW ORANGE UNDERGROUND IS THE ORANGE UP MY ASS. AND YOUR ASS.
I LOVE YOU CHEETOS.
Comment
-
Re: [College - Computer Science] Programming in VB(Drag and Drop)
Thank you again for your assistance but again, I noticed my errors and now have the quarters displaying correctly. Now I just need to work my way down and hopefully I'll get it. Thanks!
Originally posted by MrMagic5239Placements are final, custom will not be moved to D6, just because he is good at jacks, and mediocre at just about every other FMO in the game.Originally posted by customstuffOriginally posted by MrMagic5239welcome to D6
start playingComment
-
Re: [College - Computer Science] Programming in VB(Drag and Drop)
Well you keep editing your posts as I am typing them, so I have no idea what you are figuring out or still having trouble with.
YOUR THROBBING MULTIFARIOUS LUSTFUL DESIRES ARE COMPLETED N YOUR HYPER-ORANGE SELF, YOU MAKE ME LOVE AGAIN, YOU'VE CHANGED MY HEART, MY MELANCHOLIA DISAPPEARS WHEN YOU ARE INSIDE OF ME, MY HUMAN RAGE IS TEMPERED WHEN I AM INSIDE YOU, THE SECRET IS COMMUNICATION, LONGEVITY, STAMINA, REPETITION, FURY, SOULFUL KISSING, EARPLUGS. YOU FUCKING CORPORATE COCKS AND CUNTS.
MY ANXIETY COMPLETE, MY DESIRE REPLETE, THE TASTE OF ORANGE BLOOD AND CUM AND GREENBACKS RUNNING DOWN MY FACE. THE STREETS WILL RUN ORANGE WITH YOUR MIXTURE OF CHEETOS AND HUNDRED DOLLAR BILLS REGURGITATED AND EATEN AND SHIT OUT AGAIN AND EATEN AGAIN.
YOU ARE MY SCULPTURE, MY SCULPTRA, MY SELF-DEFINITION. MY DEFINITION OF HUMANITY, MY HARMONY. MY HEART AND MY MIND.
YOU ARE SO ORANGE. SO CRUNCHY. SO CONSUMABLE.
THE NEW ORANGE UNDERGROUND IS THE ORANGE UP MY ASS. AND YOUR ASS.
I LOVE YOU CHEETOS.
Comment
Comment