Advertisement
cynthiarez

ANSWER TO ADDING UP TOTAL INPUTS!!!! THIS IS IT!!!

Sep 17th, 2019
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. int num, num2, totalcur, totalall = 0, confirm;
  2.  
  3.  
  4. do {
  5. num = Integer.parseInt(JOptionPane.showInputDialog("Enter number"));
  6. num2 = Integer.parseInt(JOptionPane.showInputDialog("Enter another number"));
  7.  
  8. totalcur = num+num2;
  9.  
  10. totalall = totalcur+totalall;
  11.  
  12.  
  13. confirm = JOptionPane.showConfirmDialog(null, "Current total is: " + totalall + ". Input more number?");
  14. }
  15. while (confirm!=1);
  16.  
  17. JOptionPane.showMessageDialog(null,"Overall total is: " + totalall);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement