Question
import java.util.*; public class BankAccount { private int accountNumber; private String ownerName; private double balance; private String type; public BankAccount() { accountNumber = 0; ownerName
import java.util.*;
public class BankAccount {
private int accountNumber;
private String ownerName;
private double balance;
private String type;
public BankAccount() {
accountNumber = 0;
ownerName = "";
balance = 0.0;
type = "Personal";
}
public BankAccount(int number, String name, double initialDeposit, String type) {
accountNumber = number;
ownerName = name;
balance = initialDeposit;
this.type = type;
}
public int getAccountNumber() {
return accountNumber;
}
public void setAccountNumber(int number) {
accountNumber = number;
}
public String getOwnerName() {
return ownerName;
}
public void setOwnerName(String name) {
ownerName = name;
}
public double getBalance() {
return balance;
}
public void setBalance(double newAmount) {
balance = newAmount;
}
public String getType() {
return type;
}
public void deposit(double amount) {
balance += amount;
}
public void withdrawl(double amount) {
balance -= amount;
}
public String toString() {
return type + ": " + accountNumber + " " + ownerName + " " + balance;
}
}
In a different Java class, called ClientUpdate.java, create a bank's client processing program with the following specifications The single client's file contains information on all that person's accounts (personal, business and charitable), including deposits, withdrawals, interest earned and charges. These are all stored in a text file, the name of the file should be input from the keyboard The first line of the file contains an integer, called number, indicating the number of accounts and the client's name The next number lines of the file contain, for each account, a String token indicating the type of the account and a unique integer representing the account number and a real number indicating the starting balance o o An array of BankAccounts can be created to hold the client file information. Use a constructor from the BankAccount class to instantiate each of the accounts Following that, there are an unknown number of lines, each contains the integer identification number for the account, a String (one of "deposit", "withdrawal", "interest", "charge") indicating the type of transaction, and a real number indicating the amount of the transaction o The amount of a deposit must be added to the BankAccount's balance; The amount of a withdrawl must be subtracted from the balance . The amount of interest requires adding 'amount' % interest to the account; * The amount of a (service) charge must be subtracted from the account. Use member methods of the BankAccount class to alter the attributes of the appropriate BankAccount object Once the entire file has been processed output all attributes of each account to the screen Use the instance method called toString ()to make a single String containing all attributes of a BankAccount object that is being printed oStep 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