Question
public class AccountRecord { private int accountNo; private String fullName; private double balance; // initialize a record public AccountRecord(int acctNo, String name, double bal) {
public class AccountRecord {
private int accountNo;
private String fullName;
private double balance;
// initialize a record
public AccountRecord(int acctNo, String name, double bal) {
setAccountNo( acctNo );
setFullName( name );
setBalance( bal );
} // end four-argument AccountRecord constructor
// set account number no
public void setAccountNo( int acctNo ) {
accountNo = acctNo;
} // end method setAccountNo
// get account number no
public int getAccountNo() {
return accountNo;
} // end method getAccountNo
// set full name
public void setFullName( String name ) {
fullName = name;
} // end method setFullName
// get full name
public String getFullName() {
return fullName;
} // end method getFullName
// set balance
public void setBalance( double bal ) {
balance = bal;
} // end method setBalance
// get balance
public double getBalance() {
return balance;
} // end method getBalance
} // end class AccountRecord
Make a public class called ReadAccounts. This class will read a file (accountsData.txt) where the data is Text-based. Once the file has been read, you must save each note in an arrangement. (Use the aforementioned AccountRecord class.) Once each account in the array has been read, you must add each balance and this must be the output:
No. Account Name Balance
-------------------------------------------------- -----------------
12345 Carlos De La Torre $1,000.00
12347 Jose Medina $2,300.25
-------------------------------------------------- -----------------
Total counts read: 2
Total accounts: $3,300.25
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started