Question: JAVA public class AccountRecord { private int accountNo; private String fullName; private double balance; // initialize a record public AccountRecord(int acctNo, String name, double bal)
JAVA
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
1. Make a public class called WriteAccounts. This class will write to a file (accountsData.txt) where the data is Text-based. The program should ask for several counts, and save the data in an array, until it indicates that it is the end, then save each record or array to a file. (Use the AccountRecord class.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
