Question: For each method add a precise description of its purpose, input and output. Explain the purpose of each member variable. /* ADD COMMENTS TO THIS
|
For each method add a precise description of its purpose, input and output. Explain the purpose of each member variable. /* ADD COMMENTS TO THIS CLASS, DO NOT CHANGE ANY CODE! */ import java.util.*; public class BankAccount { private int accountNumber; private String ownerName; private double balance; private String type; // Personal, Business, Charitable 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; // Why does 'this' need to be used here?? } 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;
|
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
