Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In this project, you will be implementing text file base Bank Management Project

ID: 3748007 • Letter: I

Question

In this project, you will be implementing text file base Bank Management Project (BMP). In this project, when your program starts, you will be reading your customer's information, and transaction history from csv files. BMP will have a few objects Bank Account (Account Holder, balance, type of customer, credit limit), Transaction(id, customer_id, transaction_type, transaction_date,transaction_time, transaction_amount).

Your program will have following features:

1- Add/ Remove/Update Customer Information in the system.

2- Deposit/Withdraw Money

4- Request Credit

5- Listing transactions for a given specific customer(with full name)

6- Exit and Save

The program menu design is flexible, but the menu options should be grouped based on semantically and named properly. The program also should store the transaction history for all customers in the same file. So, you should be able to append translations into the log file. When you make any change on the customer information or when you make any transaction, that information needs to be stored into the csv file. When you rerun the program, all updates should be available to the user.

Explanation / Answer

import java.io.BufferedReader;

import java.io.FileReader;

import java.io.IOException;

import java.util.ArrayList;

import java.util.List;

import java.util.Scanner;

public class ReadCSVCustomerInformation {

public static void main(String[] args) throws IOException {

// open file input stream

BufferedReader reader = new BufferedReader(new FileReader(

"bankmanagement.csv"));

// read file line by line

String line = null;

Scanner scanner = null;

int index = 0;

List<Customer> custList = new ArrayList<>();

while ((line = reader.readLine()) != null) {

Customer emp = new Customer();

scanner = new Scanner(line);

scanner.useDelimiter(",");

private int id;

private int customer_id;

private String transaction_type;

private String transaction_date;

private String transaction_time;

private int transaction_amount;

while (scanner.hasNext()) {

String data = scanner.next();

if (index == 0)

emp.setname(data);

else if (index == 1)

emp.setbalance(data);

else if (index == 2)

emp.settype(data);

else if (index == 3)

emp.setcreditlimit(data);

else if (index == 4)

id = data;

else if (index == 5)

customer_id = data;

else if (index == 6)

transaction_type = data;

else if (index == 7)

transaction_date = data;

else if (index == 8)

transaction_time= data;

else if (index == 6)

transaction_amount = data;

else

System.out.println("invalid data::" + data);

index++;

}

index = 0;

private int id;

private int customer_id;

private String transaction_type;

private String transaction_date;

private String transaction_time;

private int transaction_amount;

Transaction t = new Transaction(id,customer_id,transaction_type,transaction_date, transaction_time,transaction_amount);

emp.setTransaction(t);

custList.add(emp);

}

//close reader

reader.close();

Add/ Remove/Update Customer Information in the system.

public addCustomer(){

Customer customer = new Customer();

customer.setname("rama");

customer.setbalance(100);

customer.settype("personal");

customer.setcreditlimit(100);

empList.add(customer);

}

public removecustomer(String name){

for(Customer cust : custList){

if(cust.getName().equalsIgnorecase(name)){

custList.remove(cust);

}

}

public updatecustomer(Customer customer){

int counter =0 ;

for(Customer cust : custList){

counter++;

if(cust.getName().equalsIgnorecase(name)){

custList.set(counter,customer);

}

// Deposit money

public deposit(int amount,int customerid){

for(Customer cust : custList){

if(cust.getName().equalsIgnorecase(name)){

Transaction t = cust.getTransaction();

if(t.getcustomerid() == customerid){

t.gettransaction_amount() = amount;

int temp = amount + cust.getBalance();

cust.setbalance(temp);

}else{

System.out.println("Sorry wrong customer id cannot be updated");

}

}

//Wothdraw money

public boolean withdraw(int amount,int customerid){

for(Customer cust : custList){

if(cust.getName().equalsIgnorecase(name)){

Transaction t = cust.getTransaction();

if(t.getcustomerid() == customerid){

t.gettransaction_amount() = amount;

int temp = cust.getBalance() > amount ? amount - cust.getBalance() : 0;

if(temp == 0)

System.out.println("Insufficient balance");

return false;

else

System.out.println("Withdrawn " + amount + " Balance " + temp);

cust.setbalance(temp);

return true;

}else{

System.out.println("Sorry wrong customer id cannot be updated");

}

}

// Request Credit

public int reqcredit(String custname){

for(Customer cust : custList){

if(cust.getName().equalsIgnorecase(custname)){

System.out.println("This is the credit of the customer " + cust.getCredit());

}

}

//Listing transactions for a given specific customer(with full name)

public String reqtransaction(int customerid){

for(Customer cust : custList){

if(cust.getTransaction().getCustomerid() == customerid){

System.out.println("This is the entire transaction of the customer " + cust.getTransaction(). toString());

}

}

//6- Exit and Save

public void exit(){

System.exit(0);

}

}

}

System.out.println(empList);

}

}

public class Customer{

private String name;

private int balance;

private String typeofcust;

private in creditlimit;

private Transaction transaction;

public setTransaction(Transaction t){transaction = t;}

public getTransaction()[return transaction;}

public void setname(String name) { this.name = name;}

public String getname(){return name;}

public void setbalance(int bal){ this.balance = balance;}

public int getbalance(){return balance;}

public void settype(String typeofcust){this.typeofcust = typeofcust;]

public String gettype(){return this.gettype);

public void setcreditlimit(int creditlimit){this.creditlimit = creditlimit;}

public int getcreditlimit(){return creditlimit;}

}

public class Transaction {

private int id;  

private String customer_id;

private String transaction_type;

private String transaction_date;

private String transaction_time;

private int transaction_amount;

public Transaction (int id, int customerid ,String transaction_type, String transaction_date, String transaction_time,int transaction_amount) {

this.id = id;

this.customer_id= customer_id;

this.transaction_type= transaction_type;

  

this.transaction_date= transaction_date;

this.transaction_time= transaction_time;

this.transaction_amount= transaction_amount;

}

public int getid(){return id;}

public int getcustid(){return customer_id;}

public String gettransactype(){return transaction_type;}

public String gettransacdate(){return transaction_date;}

public String gettransactime(){return transaction_time;}

public String gettransacamount(){return transaction_amount;}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote