Computer Science Canada Convertinga an old turing program to java.. |
Author: | Insectoid [ Thu Oct 02, 2008 2:17 pm ] | ||
Post subject: | Convertinga an old turing program to java.. | ||
we all remember this thread, right? http://compsci.ca/v3/viewtopic.php?p=159343&highlight=#159343 Well, This year, I have to do the same thing in Java. I figured, heck, I'll just use the same code and convert it to java! unfortunately, this comes with the same glitches as a year ago. I looked over it, but can't find the issue (Terrible at debugging I am). Any help. (holy nostalgia...). Anyways, the point is, it gives me the wrong ammount of change. Super messy code (Very much miss F2 from Turing...)
|
Author: | Clayton [ Thu Oct 02, 2008 2:33 pm ] |
Post subject: | RE:Convertinga an old turing program to java.. |
Sample input and output would be extraordinarily helpful in solving this problem. |
Author: | Insectoid [ Thu Oct 02, 2008 2:53 pm ] |
Post subject: | RE:Convertinga an old turing program to java.. |
Sorry, the school had ended before I finished posting, so it was rather rushed. Input, for the moment, is static and pre-defined. The objective is to input an amount of money as well as the price of an item and have it output the change using the minimum number of coins/bills possible. As of now, a total value of 20.00 with an item price of 5.00 will output something like 9 twenties, 1 ten, and one five. If I remember correctly. Yes, the variable names are terrible (I did the original within the first month of programming). I found a whole bunch of mistakes in it already, but I fixed them. The nice thing here is, Java AND Turing people can help me! lol (really, laughing right now) Thanks. |
Author: | HellblazerX [ Thu Oct 02, 2008 3:33 pm ] |
Post subject: | RE:Convertinga an old turing program to java.. |
I just ran your program and it looked fine to me. |
Author: | Insectoid [ Fri Oct 03, 2008 1:14 pm ] | ||
Post subject: | RE:Convertinga an old turing program to java.. | ||
You sure you didn't get this?:
Because that is not fine. This totals to $195 change after entering $20.00. EDIT: Oh, crap. The problem was not my code, but my static input. I had it set to 20000 cents ($200) rather than 2000 cents ($20). I must say, this is the absolute stupidest mistake of my life. Wow... |
Author: | gitoxa [ Fri Oct 03, 2008 5:36 pm ] |
Post subject: | Re: RE:Convertinga an old turing program to java.. |
insectoid @ Fri Oct 03, 2008 1:14 pm wrote: I must say, this is the absolute stupidest mistake of my life. Wow...
Then you've got a lot of catching up to do. ![]() |