Question
Class to be used for questions 1 and 2: public class AccountRecord implements Serializable { private int accountNo; private String fullName; private double balance; //
Class to be used for questions 1 and 2:
public class AccountRecord implements Serializable { 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 ReadAccounts. This class will read a file ("accountsData.bin") where the data is "Byte-based stream". Once read the file should print the total sum of the balance sheets and their average (Use the AccountRecord class mentioned above)
2. Make a public class called WriteAccounts. This class will write in a
file ("accountsData.bin") where the data is "Byte-based stream". The program
must ask several accounts, and save the data in a file (Use the class
AccountRecord).
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