Vous êtes sur la page 1sur 4

import java.util.

*;

class Atm

public static void main()

Scanner sc=new Scanner(System.in);

Atm bk=new Atm();

for(int i=1;i<=150;i++)

System.out.print("#");

System.out.println(" ");

System.out.println("\t \t\t \t \t \t \t \t welcome\n\t \t \t \t \t \t \t mas bank Atm poreyahat");

System.out.println("enter a/c holder's name:-");

String name=sc.nextLine();

System.out.print("\u0000");

name=name.toUpperCase();

System.out.println("enter a/c no");

Long no=sc.nextLong();

System.out.println("enter a/c balance");

Double amount=sc.nextDouble();

System.out.println("your pin has been genrated and sent to your register moblie no \n if you want to
see again please enter1");

int a=sc.nextInt();

Long pin=(Math.round(Math.random()*10000));

if(a==1)

System.out.println("your pin="+pin);

}
System.out.println("choose one of follwing");

System.out.println("1.withdraw \t 2.deposit \t 3.exit \t 4.balance inq");

int op=sc.nextInt();

if(op!=1 ||op!=2||op!=3 ||op!=4 )

{System.out.println("please enter valid choice");

op=sc.nextInt();

System.out.println("if you want to contiue please re-enter your pin");

int pin2=sc.nextInt();

if(pin2 !=pin)

System.out.println(" please re-enter your valid pin");

pin2=sc.nextInt();

if(pin2==pin)

if(op==1)

System.out.println("please enter the amount to be withdrawn");

Double withal=sc.nextDouble();

bk.withdrawl(amount,withal);

if (op==2)

System.out.println("please enter the amount to be deposit");

Double depo=sc.nextDouble();
bk.deposit(amount,depo);

if(op==4)

System.out.println("do you want the recepit to be printed \n if yes press 1 \n if no press 0");

int yes=sc.nextInt();

if(yes==1)

System.out.println("your recepit has been successful printed");

bk.inq(amount);

if(op==3)

System.out.println("\t \t \t \t \t \t \t "+name+ "\n\t \t \t \t \t \t \t thanx---- meet again!!!");

else

System.out.println("you have not entered valid pin ,retry.......");

if(op!=3)

System.out.println("\t \t \t \t \t \t \t "+name+"\n\t \t \t \t \t \t \t thanx---- meet again!!!");

for(int i=1;i<=150;i++)

{System.out.print("#");

}
void withdrawl(double amount,double withal)

if(withal<=amount)

System.out.println("your amount has been succeessfully withdrawl");

System.out.println("your cuurent a/c blance="+(amount-withal));

else

System.out.println("you don't have sufficient balnace");

System.out.println("your cuurent a/c balance="+amount);

void deposit(double amount,double depo)

System.out.println("your amount has been successfully deposit");

System.out.println("your current a/c balance="+(amount+depo));

void inq(double amount)

System.out.println("your cuurent a/c blance"+amount);

Vous aimerez peut-être aussi