Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Extended Savings account: in this Extended Saving account, after opening the new

ID: 3771644 • Letter: E

Question

Extended Savings account: in this Extended Saving account, after opening the new account no withdrawals can occur in first 60 days. If user attempted withdrawal occures , the system will not allow it.

--------------------------------------------------------

package bankapp;

import java.util.Date;
import java.util.Calendar;
import java.util.Locale;

public class ExtendedSavingAccount extends BankAccount
{
      private double interest = 1.0;
      private int lockOutPeriod;
      private int days;
     // public int Days;

   ExtendedSavingAccount(String name, double balance, int dateCreated, int lockOutPeriod)
   {

       super(name, balance);
       this.bal = balance;
       this.accountType = " extended saving";
       this.lockOutPeriod = lockOutPeriod;
     

       //this.accountType = " extended saving";
   }
   float interestRate, displayBalance;

   double bal;

   void withdrawal(double amount)
   {
     
      // if(Days.daysBetween(Calendar.getInstance().getTime(), dateCreated).getDays() > lockOutPeriod)
       {
           super.withdraw(amount);// call base class withdraw
       }
   }


    double interestRate()
   {
    if (bal <30)
    {
      balance = balance*0.05f;
    }else if (bal <60)
        {
            balance = balance * 0.06f;
        }else if (bal < 90)
            {
                balance = balance * 0.08f;
            }else if (bal < 180)
                {
                    balance = balance * 0.1f;
                }
    return balance;
   }
    double displayBalance()
   {
       return balance;
   }
    @Override
   public String toString()
        {
          return " Name: " + customerName + " Balance:"+ balance + " Date:"+ dateCreated;
        }
}

Explanation / Answer

we can pass the days in the function withdraw and make these changes:

void withdrawal(double amount,int days)
   {
       if (days>=0 && days <=60)

{System.out.println("money cannot be withdrawn in the first 60 days of opening the account");

else{
      // if(Days.daysBetween(Calendar.getInstance().getTime(), dateCreated).getDays() > lockOutPeriod)
       {
           super.withdraw(amount);// call base class withdraw
       }
   }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote