Sie sind auf Seite 1von 7

Computer project code for icse

Banking..

import java.util.*;
class BANKING
{
String aname,accno;
double bal;
int pin;
public BANKING()
{
Scanner sc=new Scanner(System.in);
while(true)
{
System.out.println("\n 1.Account open");
System.out.println("\n 2.withdrawal of money");
System.out.println("\n 3.Deposit transaction");
System.out.println("\n 4.Statement");
System.out.println("\n 5.Quit/Exit");
System.out.println("\n\n\n\n\n Enter your choice(1-5):");
int ch=sc.nextInt();
if(ch==1)
accopen();
if(ch==2)
withdrawal();
if(ch==3)
depo();
if(ch==4)
state();
if(ch==5)
break;
}
}
public void accopen()
{
Scanner sc=new Scanner(System.in);
Random rand=new Random();
System.out.println(" \nEnter name of the person");
aname=sc.nextLine();
System.out.println("\nEnter your Aadhar/Voter/Pan card
Number");
long kyc=sc.nextLong();
System.out.println("\nEnter your mobile no");
long mno=sc.nextLong();
System.out.println("\nEnter your date of birth .....
dd/mm/yy");
String dob=sc.nextLine();
System.out.println("\nEnter your age ");
int age=sc.nextInt();
if(age>=18){

System.out.println("*********************************
**************************************************
******************************************");
System.out.println("\n\n\n\t YOUR ACCOUNT HAS BEEN
OPENED ");

System.out.println("*********************************
**************************************************
********************************************");
System.out.println("\n\t\t There are two kinds of
accounts");
System.out.println("\t\t\t 1.Savings Account");
System.out.println(" \t\t\t2.Current Account");
System.out.println("Type the account you opt for");
String choice=sc.nextLine();
System.out.println(" Balance to be deposited");
bal=sc.nextDouble();
System.out.println("\nAccount no provided by the bank");
accno=Integer.toString(rand.nextInt(2147483647)+90000000
0)+"XXXX";
System.out.println(accno);
System.out.println(" Do you want to pursue ATM card .....
YES/NO");
String yn=sc.nextLine();
if(yn.equalsIgnoreCase("yes"))
{
System.out.println("Enter your desired pin code");
pin=sc.nextInt();
System.out.println(" Thank You for Opening an Account in
our bank");

}
else
System.out.println(" Thank You for Opening an Account in
our bank");
}
else System.out.println("Account cannot be opened");
}
public void withdrawal()
{
Scanner sc=new Scanner(System.in);
System.out.println("\n Enter your account number ...");
String pacno=sc.nextLine();
System.out.println("\n Enter your pin");
int ppin=sc.nextInt();
System.out.println("\n Enter your amount to be withdrawn");
double pwith=sc.nextDouble();
if(pacno.equals(accno))
{
if(ppin==pin){
if(pwith<=(bal-3000) && pwith<= 20000)
{
System.out.println("\n YES YOU CAN PROCEED");
bal=bal-pwith;
}
int c=1;
while (c<=2)
{
System.out.println("\n Sorry ,your pin is
incorrect,please retry");
System.out.println("\n Enter your pin");
int ppino=sc.nextInt();
if(ppino==pin)
break;
else
continue;
}
if(pwith<=(bal-3000) && pwith<= 20000)
{
System.out.println("\n YES YOU CAN PROCEED");
bal=bal-pwith;
}
}
}
System.out.println("\n Money withdrawn= Rs"+ pwith);
System.out.println("\n Balance =Rs"+bal);
}
public void depo(){}
public void state(){}
}

Das könnte Ihnen auch gefallen