Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Help please with comment the below Java code. What the classes, objects, constructors and methods do. Thanks! public class SavingsAccount { float rate = 1;
Help please with comment the below Java code. What the classes, objects, constructors and methods do. Thanks! public class SavingsAccount { float rate = 1; float balance; boolean closed = false; public SavingsAccount(boolean closed) { this.closed = closed; } int accountNumber; static int GetAccountNumber=1001; String accountType = "Savings"; public SavingsAccount(float rt, float balance) { rate = rt; this.balance = balance; accountNumber = GetAccountNumber++; } public void close(String name) { closed = true; System.out.println("Account closed"); System.out.println("Account number: " + accountNumber); System.out.println("Account holder Name: "+name); System.out.println("Balance: " + balance); System.out.println("Account type: " + accountType); System.out.println("With interest 1,2 %:"); System.out.println("Interest amount: " + 0.012f * balance); } public void print(String name) { System.out.println("Account number: " + accountNumber); System.out.println("Account holder name: " + name); System.out.println("Balance: " + balance); System.out.println("Account type: "+accountType); System.out.println("Interest rate: "+rate); } public int getAccountNumber() { return accountNumber; } public String getAccountType() { return accountType; } public void deposit(float amount) { balance += amount; } public float withdraw(float amount) { if (amount > balance) { System.out.println(" Insufficient balance!"); return 0; } return 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