Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Java 

[TUT]Your First Calculator in Four Easy Steps[TUT]

nice, but when I saw advanced I expected something a little more... well... advanced... :)
you should update it and add a GUI :)
I don't have the time to update this sorry :P I may in the future though!
(Nov 14, 2010 09:50 AM)Zeveso Wrote:  nice, but when I saw advanced I expected something a little more... well... advanced... :)
you should update it and add a GUI :)

Here is one with a GUI:
https://hackforums.net/showthread.php?tid=283322
You just link to another thread, which links do a download or tutorial or something.
(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.
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
Lol I really never did Math first when I first started, I did it when I was a little bit more knowledgable in it.
(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

if (operator.equals("/")){
result = num1 / num2;
if (num2 == 0){
System.out.println("ERROR");
System.out.close();
}}

So proud of myself :P

You should check if it is 0 before trying to divide them, using your method you will still get an exception.
Thanks for the advice Ben121!
(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
(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

if (operator.equals("/")){
result = num1 / num2;
if (num2 == 0){
System.out.println("ERROR");
System.out.close();
}}

So proud of myself :P

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..!
Thanks Ompet! I am going to attempt C++ now :P
Are you good at java coding?
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.
Nice posted Basic Calculator


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by ScrewbaccaDec 2, 2016 10:50 AM 19 1,366 Dec 2, 2016 10:50 AM
Last Post: Goodies
[C] by NielyMar 22, 2014 08:21 AM 8 210 Mar 22, 2014 08:21 AM
Last Post: Niely
[.NET] by KeeloFeb 9, 2013 10:39 PM 5 401 Feb 9, 2013 10:39 PM
Last Post: 0xDEAD10CC