Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Watson Watson

5th Edition

0471715360, 978-0471715368

More Books

Students also viewed these Databases questions