Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Java programming calculator

Name: Dan 2012-12-02 23:46

I had to make a calculator using stacks. Here is what i have so far. For some reason, the equal sign doesn't work. Can someone help me fix this. The code shows no error,
http://pastebin.com/SjemnE0V

Name: Anonymous 2012-12-03 0:49

Use printf debugging: make calculate() show a popup when it is called to see if it is called right.  If that worked, then start putting them at different places throughout its logic and printing to see if it's doing what you expect.  For example, have it print str to see if it's really one of the values you expect.

Speaking of str, you should have a default fallthrough at the end of that if-else chain to print an error if it gets an unexpected value:

if(str.equals("-")){
    /* do stuff */
} else if(str.equals("+"){
    /* do stuff */
} else {
    show_popup("unexpected value of str: " + str);
}

And similarly in other places throughout your program.

Name: Anonymous 2012-12-03 1:24

>>1 posts a link to miserable pile of spaghetti.
>>2 suggests adding tumors.
>>3 tells >>1,2 to go back to /b/, please.

Name: Anonymous 2012-12-03 2:25

>>1
Thanks for reminding me why, after Lisp, I didn't look back.

Name: Anonymous 2012-12-03 2:31

>>2

java have no debuggers?

Name: Anonymous 2012-12-03 2:38

>>5
How does the code smell?


Sloooooow!

Name: Anonymous 2012-12-03 2:53

>>5

Why use a debugger when you have printf() System.out.println() SomeJavaGuiShit.MessageBoxFactory()?

Name: Anonymous 2012-12-03 4:37

When I saw ``Java programming calculator'', I immediately thought that it is a salary calculator for aspiring enterprise scalable n-tier turkey solutionist employees.

Name: Anonymous 2012-12-03 8:31

When I saw ``Java programming calculator'', I knew >>1-san came from /g/.

I'd tell >>1-san we don't help /g/aylords or any other retard with their homeworks but it doesn't matter anyway since they never listen.

Name: Anonymous 2012-12-03 9:12

>LLLEEEEEEEEEEEEEEEEEEEEEEEEEEELLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL>LELLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
LELLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
>EGINWIMGOINGWIM /G/RO
>LE LEL FACE
>LEEEEEEEEEEEEEEEEEEEEEELLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL

Name: Anonymous 2012-12-03 9:25

Super Turbo Turnkey Solution Provider THREE

Name: Anonymous 2012-12-03 10:08

String numbers[]={"0","1","2","3","4","5","6","7","8","9","+","-","*","/",".","CE","C","=","+/-"};

I don't think you belong here.

Name: Anonymous 2012-12-03 10:14

>>12
CE is a valid number and it means Current Era

Name: Anonymous 2012-12-03 11:00

>>13
In the case of calculators, it means "clear everything", and is definitely not a number.

Name: Anonymous 2012-12-03 11:07

Lies. It means CUNT EXTERMINATOR

Don't change these.
Name: Email:
Entire Thread Thread List