Advertisement
shadowsofme

Why Can't I Reject Letters

Jan 19th, 2015
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | None | 0 0
  1. String string1 = JOptionPane.showInputDialog("How many quarters do we add?:");
  2.     // If the user enters a number above 0 in the text box, then the program sets that
  3.     // value to the number of quarters to add. Otherwise, the program errors out.
  4.     if (string1.equals("") == true || Integer.parseInt(string1) < 0){
  5.         JOptionPane.showMessageDialog (
  6.             null, "Please enter a positive or zero value for the added money.\nNo money added.",
  7.                 "Number Error",
  8.             JOptionPane.ERROR_MESSAGE);
  9.         addedQ = 0;
  10.         addedD = 0;
  11.         addedN = 0;
  12.         addedP = 0;
  13.     }else {
  14.         addedQ = Integer.parseInt(string1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement