Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. public static void main(String[] args)
  2. {
  3. String balance;
  4. double realbalance;
  5. int years=0;
  6.  
  7.  
  8. balance=JOptionPane.showInputDialog("Please Enter A Balance");
  9. realbalance=Double.parseDouble(balance);
  10.  
  11. while(realbalance !=100000)
  12. {
  13. realbalance=realbalance*2;
  14. years=years+1;
  15. if(realbalance>100000)
  16. {break;}
  17. while(realbalance>100000)
  18. {
  19. JOptionPane.showMessageDialog(null, years+"years");
  20. realbalance=realbalance*2;
  21. years=years+1;
  22.  
  23. }
  24. while(realbalance>1000000)
  25. {
  26. JOptionPane.showMessageDialog(null, years+"years");
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement