Question
1 - Make a public class called ReadAccount. This class will read a file ("accountsData.txt") where the data is "Byte-based stream." After reading the file should print the total sum of blanaces. The data should be read into an array. (Use AccountRecord class).
2 - Make a public class called WritenAccounts. This class will write to a file ("accountData.txt") where the data is "Byte-based stream." The program should ask several accounts and save the data in an array, to indicate that it is the end, then save each record or array in a file. (Use AccountRecord class).
Solution Preview
This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.
public final class AccountRecord implements Serializable{private int account;
private String firstName;
private String lastName;
private double balance;
//no-argument constructor calls other constructor with default values
public AccountRecord() {
this ( 0, "", "", 0.0); //call four-argument constructor
}// end no-argument AccountRecord constructor
// initialize a record
public AccountRecord (int acct, String first, String last, double bal) {
setAccount (acct);
setFirstName (first);
setLastName (last);
setBalance (bal);
} //end four-argument AccountRecord constructor...