Guest User

Untitled

a guest
Dec 14th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. class ATM {
  2.  
  3. public static void main(String[] args) {
  4.  
  5. java.util.Scanner sc = new java.util.Scanner(System.in);
  6. double w_cash = sc.nextDouble();
  7. double balance = sc.nextDouble();
  8.  
  9. if((w_cash > 0 && w_cash <= 2000) && (balance >= 0 && balance <= 2000)) {
  10.  
  11. if((w_cash % 5) == 0 && w_cash < balance) {
  12. double r_cash = balance - w_cash ;
  13. System.out.println(r_cash - 0.50);
  14. }
  15. else if(w_cash >= balance || (w_cash % 5) != 0) {
  16. System.out.println(balance);
  17. }
  18. }
  19. }
  20. }
Add Comment
Please, Sign In to add comment