Guest User

SpiderMate

a guest
Sep 11th, 2017
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. import java.util.Scanner;
  2. class ATM
  3. {
  4. int amount;
  5.  
  6.  
  7. void withdraw()
  8. {
  9. Scanner sc = new Scanner(System.in);
  10. System.out.println("enter amount to be withdrawn");
  11. amount = sc.nextInt();
  12. System.out.println("please collect "+amount+" rupees");
  13. }
  14. void deposit()
  15. {
  16. Scanner sc = new Scanner(System.in);
  17. System.out.println("enter amount to be deposited and drop the cash");
  18. amount = sc.nextInt();
  19. System.out.println("amount of rupees "+amount+" deposited.");
  20. }
  21. public static void main(String args[])
  22. {
  23. String userName,userPassword,name,password,newPassword;
  24. int choice,amount;
  25. Scanner sc = new Scanner(System.in);
  26. userName = "saswath";
  27. userPassword = "saswathmishra";
  28. System.out.println("enter username");
  29. name = sc.next();
  30. System.out.println("enter password");
  31. password = sc.next();
  32. if(password.equals(userPassword) && name.equals(userName))
  33. {
  34. System.out.println("Welcome to Fake bank :-)");
  35. System.out.println("choose an option below to continue..");
  36. System.out.println("1.withdrawl");
  37. System.out.println("2.Deposit");
  38. System.out.println("3.balance enquiry");
  39. System.out.println("enter a choice: ");
  40. choice = sc.nextInt();
  41. ATM a = new ATM();
  42. switch(choice)
  43. {
  44. case 1 : a.withdraw();
  45. break;
  46. case 2 : a.deposit();
  47. break;
  48. case 3 : System.out.println("44,000/-");
  49. break;
  50. }
  51. }
  52. else
  53. {
  54. System.out.println("user doesnt exist");
  55. }
  56. }
  57.  
  58. }
Add Comment
Please, Sign In to add comment