what is the solution for this Java project? PART1-Requirement Create a project n
ID: 3748604 • Letter: W
Question
what is the solution for this Java project?
PART1-Requirement Create a project named FA2018_LAB2PART1 yourLastName Then add a data type class named Account_yourlastName and a driver class named Bankservice_yourLastName DATA TYPE CLASS: Provide UML and the code of data type class Account yourlastName to hold the information of an account with account number (String), customer name (String), address, balance (double) with no-argument const parameter constructor ructor Also, define some methods to handle the tasks: open account, check current balance, deposit monthly statement , withdraw, and print OPEN ACCOUNT display the output: (for example with accout last name is Le , accout first name is Liem, account number is 1567 794657, and balance is 500)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(",");
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
System.out.println("invalid data::" + data);
index++;
}
index = 0;
custList.add(emp);
}
//close reader
reader.close();
System.out.println(empList);
}
}
public class Customer{
private String name;
private int balance;
private String typeofcust;
private in creditlimit;
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;}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.