CECS 277
LAB ASSIGNMENT #3
Assigned date: 9/29
Due date: 10/6
15 points
Design a class Bank that contains a number of bank accounts. Each account has an account number and a current balance. Add an accountNumber field to the BankAccount class. Store the bank accounts in an array list. Write a readFile method of the Bank class for reading the file with the format:
accountNumber1 balance1
accountNumber2 balance2
Implement read methods for the Bank and BankAccount classes. Write a sample program to read in a file with bank accounts, then prints the account with the highest balance. If the file is not properly formatted, give the user a chance to selecct another file.
Grading
Here is the class BankAccount:
/**
A bank account has a balance that can be changed by deposits and withdrawals.
*/
public class BankAccount
{
private double balance;
private int accountNumber;
/**
Constructs a bank account with a zero balance.
*/
/**
Constructs a bank account with a given balance.
@param initialBalance the initial balance
*/
/**
Reads an account number and balance.
@param in the scanner
@return true if the data was read
false if the end of the stream was reached
*/
/**
Deposits money into the bank account.
@param amount the amount to deposit
*/
/**
Withdraws money from the bank account.
@param amount the amount to withdraw
*/
/**
Gets the current balance of the bank account.
@return the current balance
*/
/**
Gets the account number of the bank account.
@return the account number
*/
}