Question: Complete java code for methods addAccount and printStatement to register a new customer in the bank. /*Customer Class is written below

Complete java code for methods "addAccount" and "printStatement" to register a new customer in the bank.

/*Customer Class is written below */

import java.text.DateFormat; import java.util.List; import java.util.ArrayList; import java.util.Date;

public class Customer { private final String name; private final String customerId; private final Date registrationDate; private final List accountList;

public Customer(String name, String customerId, Date registrationDate) { this.name = name; this.customerId = customerId; this.registrationDate = registrationDate; this.accountList = new ArrayList<>(); }

public String getName() { return this.name; }

public String getCustomerId() { return this.customerId; }

public Date getRegistrationDate() { return this.registrationDate; }

public void addAccount(Account account) {

/* Fill in the code to add the account to the customer's accountList */

}

public void printStatement(Date toDate) {

System.out.println(" BEGIN ACCOUNT STATEMENT - " + this.getName() + " - " + DateFormat.getDateInstance().format(toDate));

/* Fill in the code to iterate over the customer's accountList and invoke printStatement for each account */

System.out.println(" END ACCOUNT STATEMENT "); }

/** * @return the accountList */ public List getAccountList() { return accountList; }

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!