Oopm
Oopm
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;
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
break;
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;
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;
}
}
}
create_account()
{
super();
}
void display_details()
{
System.out.println("Depositor Name :" +name);
System.out.println("Place: "+address);
CLASSES USED:
1. Main class.
2. Account class.
3. create_account class.(extends class Account)
FUNCTIONS USED:
1. Arrays
2. Constructor
3. Switch Case
4. Scanner Class
5. For Loop
6. Inheritance
OUTPUT :