Re: Math program problem.
At what point in the program does what is happening diverge from what you want to happen? Are you sure you're reading the values in correctly? Are you sure you're splitting the values correctly? Are you sure you're converting them to numbers and calculations correctly? Are you sure you're doing the calculations correctly? Are you sure you're printing the values correctly?
Break this problem up into smaller pieces that each do a single thing, and figure out which step isn't working. Then we'll go from there.
Recommended reading: http://www.javaprogrammingforums.com...e-posting.html
Re: Math program problem.
I tested your program and got it to work. You have to look at your op variable. You need to store a char there instead of a single character string. Look at the charAt(0) method. When you evaluate in your if statements use chars ' ' in stead of string literals " ".
Hope it helps
Re: Math program problem.
Quote:
Originally Posted by
mwr76
I tested your program and got it to work. You have to look at your op variable. You need to store a char there instead of a single character string. Look at the charAt(0) method. When you evaluate in your if statements use chars ' ' in stead of string literals " ".
Hope it helps
For the record, I think that's only part of the problem. Hint: == != .equals().
mwr76, this is why we usually try to let the OP figure it out for themselves. It's much more educational.