Answered step by step
Verified Expert Solution
Question
1 Approved Answer
*** I need help with the Customer Repository, Banking Service and Transfer Service classes. This is all done in Java *** InvestmentAccount.java BankAccount.java Customer.java Person.java
*** I need help with the Customer Repository, Banking Service and Transfer Service classes. This is all done in Java ***
InvestmentAccount.java
BankAccount.java
Customer.java
Person.java
CustomerRepository.java
ICustomerRepository.java
BankingService.java
IBankingService.java
TransferService.java
ITransferService.java
In this project, you are given the following starter code: - Person , an abstract class to model a person; - BankAccount, a class to be used as a super class for CheckingAccount, SavingsAccout , and InvestmentAccount ; - CheckingAccount, a class to model a checking account; - SavingsAccount, a class to model a savings account; - IBankAccountRepository , an interface to define a method findByAccountNumber ; - IBankingservice, an interface to define methods openBankAccount and closeBankAccount ; - ICustomerRepository, an interface to define methods findCustomerByAccountNumber and findCustomerByPhoneNumber ; - ITransfer, an interface to define a method transfer; - NoSuchBankAccountException , a customized exception class to indicate a "bank account not found" situation; - NoSuchCustomerException, a customized exception class to indicate a "no such customer found" situation; - BankAccountType , an enum class to define a set of bank account types; Your Tasks In this project, you need to implement the following items based on the given starter code: InvestmentAccount Class - Implement a class InvestmentAccount to use BankAccount as the Super class. - In this class, add a private member variable serviceFee of BigDecimal type; - Add a constructor to initialize serviceFee with a parameter of BigDecimal type; add another constructor to initialize serviceFee with a parameter of BigDecimal type; - Add getter and setter for serviceFee ; - Add a public method chargeserviceFee, in this method, subtract serviceFee from balance, and update balance . Customer Class - Implement a class Customer to use Person as the Super class. - Add a constructor Customer(String name, String phoneNumber, List bankAccounts) to initialize the member variables; - Add getters and setters for bankAccounts and phoneNumber ; - Add a public method addBankAccount(BankAccount account) to add the parameter account to the list of bank accounts for this customer. public abstract class Person \{ public abstract String getDescription(); private String name; public Person(String name) { this.name = name; } public String getName() { return name; } \} public interface ICustomerRepository \{ Customer findCustomerByAccountNumber (int accountNumber) throws NoSuchCustomerException; Customer findCustomerByPhoneNumber (String phoneNumber) throws NosuchCustomerException; \} public interface IBankingService \{ BankAccount openBankAccount(BankAccountType accountType, Customer customer); void closeBankAccount (int accountNumber); import java.math.BigDecimal; public class TransferService implements ITransfer\{ private IBankAccountRepository bankAccountRepository; public Transferservice(IBankAccountRepository bankAccountRepository) \{ \} this.bankAccountRepository = bankAccountRepository; Qoverride public void transfer(int from, int to, BigDecimal amount) throws NosuchBankAccountException \{ // Todo: transfer a certain amount of money from the bank account with the account number "from" to a bank account with the account number "to". \} import java.math.BigDecimal; public interface ITransfer \{ public void transfer (int from, int to, Bigdecimal amount) throws NoSuchBankAccountExceptionStep 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