Question: When the user create/add a customer in the console in this below Java class the user cannot type in customer name I also need to
When the user create/add a customer in the console in this below Java class the user cannot type in customer name
I also need to correct in the code so the user can edit customer name, please help with that, Thanks!
import java.util.ArrayList; import java.util.List; public class Customer { List accounts = new ArrayList<>(); int numberOfAccount; int ssn; // new member variable name String name; static int uniqueSSN = 1001; public Customer() { 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(int 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
Get step-by-step solutions from verified subject matter experts
