ATM
class Account{
String accountNumber, Name;
double initial_balance = 12000, deposit, withdraw;
void checkbalance(){
System.out.println("Balance="+initial_balance);
}
void deposition(){
deposit = 5000;
System.out.println("Deposit="+deposit);
System.out.println("Final balance = "+(deposit+initial_balance));
}
void withdrawl(){
withdraw = 6000;
if(initial_balance-withdraw < 3000){
System.out.println("Insufficient balance");
}
else{
System.out.println("Withdrawl = "+withdraw);
System.out.println("Final balance="+(initial_balance-withdraw));
}
}
void display(){
System.out.println("Name = "+Name);
System.out.println("Account No = "+accountNumber);
}
}
public class six {
public static void main(String[] args) {
int k=1;
Account al = new Account();
al.accountNumber="1378mb777";
al.initial_balance=12000;
al.Name="Rajesh";
System.out.println("Menu: 1:Check Balance 2.Withdrawl 3.Deposit");
al.display();
switch(k){
case 1 : al.checkbalance();
break;
case 2 : al.withdrawl();
break;
case 3 : al.deposition();
break;
default : System.out.println("Invalid input");
}
}
}