![]() |
|
[Java] [TUT]Your First Calculator in Four Easy Steps[TUT] - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Java] [TUT]Your First Calculator in Four Easy Steps[TUT] (/showthread.php?tid=282939) |
* - Zeveso - Nov 14, 2010 nice, but when I saw advanced I expected something a little more... well... advanced... :) you should update it and add a GUI :) * - eXero - Nov 14, 2010 I don't have the time to update this sorry :P I may in the future though! * - Fizzix - Nov 14, 2010 (Nov 14, 2010 09:50 AM)Zeveso Wrote: nice, but when I saw advanced I expected something a little more... well... advanced... :) Here is one with a GUI: https://hackforums.net/showthread.php?tid=283322 * - eXero - Nov 14, 2010 You just link to another thread, which links do a download or tutorial or something. * - eXero - Nov 14, 2010 (Nov 14, 2010 02:04 PM)Fizzix Wrote: What's your point? Explaining how to run code in Netbeans is hardly a tutorial for a calculator... With an opinion like that, you can go somewhere else and post it. Not on my threads. * - Dmaster_773 - Jan 10, 2011 started java today (first language as well) tried to fix division by zero w/o help as challenge if (operator.equals("/")){ result = num1 / num2; if (num2 == 0){ System.out.println("ERROR"); System.out.close(); }} So proud of myself :P * - Morphene - Jan 10, 2011 Lol I really never did Math first when I first started, I did it when I was a little bit more knowledgable in it. * - Ben121 - Jan 10, 2011 (Jan 10, 2011 03:17 AM)Dmaster_773 Wrote: started java today (first language as well) tried to fix division by zero w/o help as challenge You should check if it is 0 before trying to divide them, using your method you will still get an exception. * - eXero - Jan 10, 2011 Thanks for the advice Ben121! * - Dmaster_773 - Jan 11, 2011 (Jan 10, 2011 09:38 AM)Ben121 Wrote: You should check if it is 0 before trying to divide them, using your method you will still get an exception.wouldn't you need to repeat all the processes (+,*,-,/) just for 0 in that case? and it works fine, and doesn't give an answer * - Ompet - Jan 11, 2011 (Jan 10, 2011 03:17 AM)Dmaster_773 Wrote: started java today (first language as well) tried to fix division by zero w/o help as challenge What he meant was: if (operator.equals("/")){ if(if num2 == 0){ System.out.prinln("ERROR"); System.out.close(); else{ result = num1/num2; }} Im pretty bad at java, but I think this one is better..! * - eXero - Jan 11, 2011 Thanks Ompet! I am going to attempt C++ now :P * - Royal Flush - Jan 12, 2011 Are you good at java coding? * - eXero - Jan 12, 2011 Motherfucker, read the damn thread post date. This was posted over a year ago, when I was new to hackforums. I used to be good at Java, but I have moved on to other languages. This was posted when I knew Java real well. * - andie12serador - May 27, 2011 Nice posted Basic Calculator |