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. Tnanks! import java.util.ArrayList; import java.util.List; public class Customer {
Help please with comment the below Java code, what the classes, objects, constructors and methods do. Tnanks! import java.util.ArrayList; import java.util.List; public class Customer { Listaccounts = new ArrayList<>(); int numberOfAccount; int ssn; // new member variable name String name; static int uniqueSSN = 1001; public Customer() { accounts = new ArrayList<>(); numberOfAccount =0; ssn = uniqueSSN++; } public Customer(int ssn,String name) { numberOfAccount =0; this.ssn = ssn; this.name = name; } public int getSSN() { return ssn; } public String getName() { return name; } public void setName(String n) { this.name =n; } public List getAccounts() { return accounts; } public void createAccount(float rate, float amount) { SavingsAccount account = new SavingsAccount(rate,amount); accounts.add(account); numberOfAccount += 1; } public void displayAccount() { for(SavingsAccount account:accounts) { account.print(this.getName()); } } }
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