09-18-2012, 12:06 PM | #1 |
the Haku
Join Date: Jul 2005
Age: 35
Posts: 4,524
|
[College - Computer Science] Programming in VB(Drag and Drop)
Edit: Solved..
Last edited by Hakulyte; 09-18-2012 at 10:40 PM.. |
09-18-2012, 04:00 PM | #2 |
FFR Simfile Author
|
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 -> WPF
__________________
Patashu 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 |
09-18-2012, 04:55 PM | #3 |
the Haku
Join Date: Jul 2005
Age: 35
Posts: 4,524
|
Re: [College - Computer Science] Programming in VB(Drag and Drop)
The progression is fine, the way they did it is the confusing part or/and I'm bad at programming.
It's not like it was really changing anything. Last edited by Hakulyte; 09-18-2012 at 05:05 PM.. |
10-2-2012, 04:54 PM | #4 |
♥C.S. + A.M.♥
Join Date: Nov 2006
Location: Nova Scotia, Canada
Age: 30
Posts: 4,892
|
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 at 05:00 PM.. |
10-2-2012, 05:23 PM | #5 |
FFR Player
|
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?
__________________
|
10-2-2012, 06:22 PM | #6 |
♥C.S. + A.M.♥
Join Date: Nov 2006
Location: Nova Scotia, Canada
Age: 30
Posts: 4,892
|
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 at 06:40 PM.. |
10-2-2012, 06:48 PM | #7 |
FFR Player
|
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.
__________________
|
10-2-2012, 06:58 PM | #8 |
♥C.S. + A.M.♥
Join Date: Nov 2006
Location: Nova Scotia, Canada
Age: 30
Posts: 4,892
|
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!
__________________
|
10-2-2012, 07:09 PM | #9 |
FFR Player
|
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.
__________________
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|