- Write out what you want to do in pseudocode before you program
- Compile your program often
- Test your code as you go by using JOptionPane.showMessage(null, what you are testing). Things to check:
- input String
- any output from your String methods
- operand1, before and after you convert it to a floating point number
- operand2, before and after you convert it to a floating point number
- anything else you can think of
- You will be able to read in a String from the user by using something like this:
inputString = JOptionPane.showInputDialog("Please enter a string:");
Once you have an input String you need to parse the string (break up your string into groups of characters) into operand1, operator, and operand2.
-
- Use String methods (pp. 80-82, 4th edition or p. 78, 5th edition) to parse your String into operand1, operator, and operand2
- You can convert a String to different types (p. 116, 4th edition or p. 110, 5th edition)