Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hello everybody. Below I have attached a code and we are supposed to add comments explaining what each line of code does. For each method
Hello everybody. Below I have attached a code and we are supposed to add comments explaining what each line of code does. For each method add a precise description of its purpose, input and output. Explain the purpose of each member variable. . Some help would be greaty appreciated. (I have finished the code below with typing as my screen wasnt big enough to fit the whole code image)
}
public void withdrawal (double amount) {
balance -=amount;
}
public String ToString() {
return type + ": " + accountNumber + " " + ownerName + " " + balance;
}
}
ADD COMMENTS TO THIS CLASS, DO NOT CHANGE ANY CODE! import java.util.*; public class BankAccount private int accountNumber; priva private double balance private String type; // Personal, Business, Charitable ownerName: public BankAccount) accoun tNumber- ownerName -""; balance0.0 type "Personal"; public BankAccount (int number, String name, double initialDeposit, string type) ( accoun tNumber ownerName - name/ balance -initialDeposit; this.type - type // Why does 'this' need to be used here?? = number; public int getAccountNumber) ( return accountNumber public void setAccountNumber (int number) ( number ; accoun tNumber public String getownerName) return ownerName public void setownerName (String name) ownerName - name/ public double getBalance () return balance; public void setBalance (double newAmount) ( balancenewAmount public String getType ) return type; public void deposit (double amount) balance += amount
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