0% found this document useful (0 votes)
45 views

Oopm

oopm

Uploaded by

Elma Shane
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views

Oopm

oopm

Uploaded by

Elma Shane
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

OOPM PROJECT

TOPIC- BANK MANAGEMENT SYSTEM

GROUP MEMBERS – CHARANDEEP SINGH (16102063)


SHUBHAM PADTE (16102058)
MEET MAISHERI (16102061)

Problem Statement - Considering a city which has many banks. A bank can have many branches
in a particular city. A bank consists of many customers, including bank
manager, citizens, staff members and employees. Each customer of the bank
has particular ID. Customers can create two types of accounts namely,
savings and current account.Customers get the choice to choose there own
account numbers or it will be provided by the bank. Customers get facilities
like withdrawal and deposit. A customer can also avail loan facilities and
internet banking facilities.

CODE:

import java.util.*;
public class Main
{
private static ArrayList<create_account> accountList = new ArrayList<>();
private static create_account selectedAccount;
private static boolean flag = false;
public static void main(String []args)
{
String user_name=null,type,address=null;
int balance=0,tmp=0,Choice,ch=0,withd=0,cb=0;
int wd=0,currentbal=0,acn=0;
int selectedAcc=0;
int rannum = 0;

create_account user = null;


Account ac=null;

Scanner in = new Scanner(System.in);


Scanner str=new Scanner(System.in);
do
{System.out.println("************************");
System.out.println("1) Create Account");
System.out.println("2) Deposit money");
System.out.println("3) Withdraw money");
System.out.println("4) Check the balance");
System.out.println("5) Display Account Details");
System.out.println("\nPress 0 to Exit :) \n");
System.out.println("************************");

System.out.print("Enter Your Choice : ");


Choice = in.nextInt();
switch (Choice)
{
case 1:
user = new create_account ("name",0,0,"bal","address");
System.out.print("Enter your Name : ");
user_name=str.nextLine();
System.out.println("Enter your Address : ");
address=str.nextLine();
System.out.print("Enter Accout Type : ");
type=in.next();
System.out.print("Do you wanna to create your own Account number?\n1)For Yes\n2)For
No\n");
System.out.print("Enter Your Choice : ");
ch = in.nextInt();
switch(ch)
{
case 1: System.out.println("Enter Your Account number : ");
acn=in.nextInt();
System.out.println("\n\tYour Account Number is : "+acn+ "\n\tDont Forget Account
Number\n");
user.insert(user_name,acn,type,address);
break;
case 2:
rannum = 1000+(int)((Math.random()*9000));
System.out.println("\n\tYour Account Number is : "+rannum+"\n\tDont Forget Account
Number\n");
user.insert(user_name,rannum,type,address);

break;
}
//System.out.println("\n\tYour Account Number is : "+user.Acc_num+ "\n\tDont Forget
Account Number\n");
//selectedAccount.insert(user_name,rannum,type,address);
// init name,acc_number,Balance,Type,Address
accountList.add(user);
break;

case 2: // deposite

System.out.print("Enter your Account Number :");


selectedAcc=in.nextInt();

for (Object object : accountList) {


selectedAccount = (create_account) object;
if (selectedAccount.Acc_num == selectedAcc) {
flag = true;
break;
} else {
flag = false;
}
}
if (!flag) {
System.out.println("Account doesn't exists.");
}
else{
System.out.print("Enter Amount Of Money : ");
balance=in.nextInt();
selectedAccount.Acc_Balance=balance;
System.out.println("\t Successfully Deposited.");}
if (accountList.size() == 0) {
System.out.println("Zero account exists.");
}

break;

case 3: // withdraw money

System.out.print("Enter your Account Number :");


selectedAcc=in.nextInt();

for (Object object : accountList) {


selectedAccount = (create_account) object;
if (selectedAccount.Acc_num == selectedAcc) {
flag = true;
break;
} else {
flag = false;
}
}
if (!flag) {
System.out.println("Account doesn't exists.");
}
else{
if(user.Acc_Balance==0)
System.out.print("Your Account is Empty.");

else{
System.out.print("Enter Amout Of Money : ");
withd=in.nextInt();

if(withd>selectedAccount.Acc_Balance){
System.out.print("Enter Valid Amout of Money : ");
withd=in.nextInt();
}
else
cb= selectedAccount.withdraw(withd);
System.out.println("Your Current Balance : "+cb);
}
}
if (accountList.size() == 0) {
System.out.println("Zero account exists.");
}
break;

case 4: // check balance


System.out.print("Enter your Account Number :");
selectedAcc=in.nextInt();

for (Object object : accountList) {


selectedAccount = (create_account) object;
if (selectedAccount.Acc_num == selectedAcc) {
flag = true;
break;
} else {
flag = false;
}
}
if (!flag) {
System.out.println("Account doesn't exists.");
}
else{
System.out.println("Your Current Balance : "+selectedAccount.Acc_Balance);}
if (accountList.size() == 0) {
System.out.println("Zero account exists.");
}

break;

case 5: // display all info


// select account

System.out.print("Enter your Account Number :");


selectedAcc=in.nextInt();

for (Object object : accountList) {


selectedAccount = (create_account) object;
if (selectedAccount.Acc_num == selectedAcc) {
flag = true;
break;
} else {
flag = false;
}
}
if (!flag) {
System.out.println("Account doesn't exists.");
}
else{
selectedAccount.display_details();}
if (accountList.size() == 0) {
System.out.println("Zero account exists.");
}
/* for (Object object : accountList) {
tmp = object;
if(tmp==user.Acc_num){
user.display_details();
}else
System.out.println("Wrong Account Number.");
} */
break;

case 0: System.out.println("\n\nThankyou!");
break;

default:
System.out.println("Wrong Choice.");
break;
}
System.out.println("\n");
}
while (Choice!=0);
}
}

class Account
{
String name,acctype,address;
int Acc_num,Acc_Balance;
Account()
{}
Account(String n,int acc_num,int b,String a_t,String add)
{
name=n;
Acc_num=acc_num;
Acc_Balance=b;
acctype=a_t;
address=add;

}
}

class create_account extends Account


{
create_account(String n,int acc_num,int b,String a_t,String add)
{
name=n;
Acc_num=acc_num;
Acc_Balance=b;
acctype=a_t;
address=add;

}
create_account()
{
super();
}

void insert(String n,int acc_num,String a_t,String add)


{
name=n;
acctype=a_t;
Acc_num=acc_num;
address=add;
Acc_Balance=0;
}

void display_details()
{
System.out.println("Depositor Name :" +name);
System.out.println("Place: "+address);

System.out.println("Account Number : "+Acc_num);


// System.out.println("Account Number : "+acn);
System.out.println("Account Balance : "+Acc_Balance);
System.out.println("Account Type : "+acctype);
}

void deposite(int acc_num,int money)


{
Acc_Balance=money;
}

int withdraw(int wd)


{
Acc_Balance=Acc_Balance-wd;
return Acc_Balance;
}

CLASSES USED:

1. Main class.
2. Account class.
3. create_account class.(extends class Account)

FUNCTIONS USED:

1. void insert- To create a account for the user.


2. void display details- To display the details of the account holder.
3. void withdraw money- To withdraw money from the account.
4. int depsot money- To deposit money in the account.
CONCEPTS USED:

1. Arrays
2. Constructor
3. Switch Case
4. Scanner Class
5. For Loop
6. Inheritance

OUTPUT :

You might also like