Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- class ATM
- {
- int amount;
- void withdraw()
- {
- Scanner sc = new Scanner(System.in);
- System.out.println("enter amount to be withdrawn");
- amount = sc.nextInt();
- System.out.println("please collect "+amount+" rupees");
- }
- void deposit()
- {
- Scanner sc = new Scanner(System.in);
- System.out.println("enter amount to be deposited and drop the cash");
- amount = sc.nextInt();
- System.out.println("amount of rupees "+amount+" deposited.");
- }
- public static void main(String args[])
- {
- String userName,userPassword,name,password,newPassword;
- int choice,amount;
- Scanner sc = new Scanner(System.in);
- userName = "saswath";
- userPassword = "saswathmishra";
- System.out.println("enter username");
- name = sc.next();
- System.out.println("enter password");
- password = sc.next();
- if(password.equals(userPassword) && name.equals(userName))
- {
- System.out.println("Welcome to Fake bank :-)");
- System.out.println("choose an option below to continue..");
- System.out.println("1.withdrawl");
- System.out.println("2.Deposit");
- System.out.println("3.balance enquiry");
- System.out.println("enter a choice: ");
- choice = sc.nextInt();
- ATM a = new ATM();
- switch(choice)
- {
- case 1 : a.withdraw();
- break;
- case 2 : a.deposit();
- break;
- case 3 : System.out.println("44,000/-");
- break;
- }
- }
- else
- {
- System.out.println("user doesnt exist");
- }
- }
- }
Add Comment
Please, Sign In to add comment