Question
Class to be used in questions 1 and 2: public classAccountRecord { private intaccountNo; privateString fullName;private doublebalance; // initialize a record publicAccountRecord(intacctNo, String name,doublebal) {
Class to be used in questions 1 and 2:
public classAccountRecord { private intaccountNo; privateString fullName;private doublebalance;
// initialize a record
publicAccountRecord(intacctNo, String name,doublebal) { setAccountNo( acctNo ); setFullName( name ); setBalance( bal );
}// end four-argument AccountRecord constructor
// set account number no
public voidsetAccountNo(intacctNo ) { accountNo = acctNo;
}// end method setAccountNo
// get account number nopublic intgetAccountNo() {returnaccountNo;
}// end method getAccountNo
// set full name
public voidsetFullName( String name ) { fullName = name;
}// end method setFullName
// get full namepublicString getFullName() {returnfullName;
}// end method getFullName
// set balance
public voidsetBalance(doublebal ) { balance = bal;
}// end method setBalance
// get balancepublic doublegetBalance() {returnbalance;
}// end method getBalance
}// end class AccountRecord
1. 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 print the total sum of the balances. The data must be read in an array. (Use the AccountRecord class mentioned above).
2. 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 several accounts, 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
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