SHARE
TWEET

Untitled

a guest Aug 22nd, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   In this project, you are going to be creating a simple calculator that will only operate on positive numbers. Your program has already been set up to take in a single line of input formatted as a String, without spaces.  You may assume that the input is guaranteed to be valid.  The output should be something like "The result is ____".
  2.  
  3. Your result must be printed as an integer.
  4.  
  5. Your program should be able to handle the following operators:
  6. Addition
  7. Subtraction
  8. Multiplication
  9. Division
  10. Modulo
  11. You may find a new String method, .contains(), to be helpful.
  12. .contains(char/String)
  13. returns: true if the char/String is found in the original String, false otherwise
  14.  
  15. You can use the following to convert Strings to ints (assuming they can be converted):
  16. Integer.parseInt(str);
  17.  
  18. Sample input/output:
  19. In:53-22
  20. The result is 31
  21. In:39%4
  22. The result is 3
  23. In: 65
  24. The result is 32
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top