Question: Code given: Account.java import java.io.Serializable; public class Account implements Comparable , Serializable { protected int accnum; protected HolderDetails holder; protected List transactions; protected float balance;

Code given:
Account.java
import java.io.Serializable;
public class Account implements Comparable
protected int accnum;
protected HolderDetails holder;
protected List
protected float balance;
public Account(int accnum, HolderDetails holder, List
//super();
this.accnum = accnum;
this.holder = holder;
this.transactions = transactions;
this.balance = balance;
}
public int getAccnum() {
return accnum;
}
public HolderDetails getHolder() {
return holder;
}
public List
return transactions;
}
public float getBalance() {
return balance;
}
public boolean withdrawal(float amount) {
if (amount > getBalance()) {
System.out.println("Account balance is low!!");
//return false;
}else {
float remainingBalance = getBalance() - amount;
this.balance = remainingBalance;
return true;
}
}
public void deposit(float amount) {
float balanceAfterDeposit = getBalance() + amount;
this.balance = balanceAfterDeposit;
}
public void printAccountDetails() {
System.out.println("Account No: " + getAccnum());
System.out.println("Balance: " + getBalance());
System.out.println("Holder Details: " + holder.toString());
System.out.println("Transaction details: ");
getTransactions().forEach(transaction -> System.out.println(transaction.toString()));
}
@Override
public int compareTo(Account arg0) {
return Integer.valueOf(this.getAccnum()).compareTo(Integer.valueOf(arg0.getAccnum()));
}
}
b: Provide implementations for the HolderDetails class and the Transaction class. The HolderDetails class is used to store personal details about the account holder. The Transaction class contains details about past transactions including MARKS c: Define and implement a new class, called CurrentAccount, derived from Account, that allows withdrawals to proceed up to some overdraft limit. Note that the base Account class shown has no overdraft facility 5 MARKS b: Provide implementations for the HolderDetails class and the Transaction class. The HolderDetails class is used to store personal details about the account holder. The Transaction class contains details about past transactions including MARKS c: Define and implement a new class, called CurrentAccount, derived from Account, that allows withdrawals to proceed up to some overdraft limit. Note that the base Account class shown has no overdraft facility 5 MARKS
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
