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

I need help to solv the second part of this problem. The first part is solved, t

ID: 3631712 • Letter: I

Question

 

 

 

I need help to solv the second part of this problem. The first part is solved, the qustion in the images above.The first design is

public abstract class BankAccount
{
public double rate; //interest rate
public double balance;//balance
public double withdrawals; //withdrawals
public double charges; //service charges
public double deposits; // #of deposits

public BankAccount(double bal, double ir)//constructor receives balance and interest rate.
{
balance = bal;
rate = ir;
}

//method to accept the amount of the deposit as an argument, it then increments the # of deposits and adds the deposit to balance.
public void deposit(double dep)
{
balance += dep;// adds amount of deposit to balance
deposits++;//increments the amount of deposits
}

//method accepts arugment for the amount of withdarawl, subtracts it from balance
public void withdraw(double wd)
{
balance -= wd;//subtracts withdrawal amount from balance
withdrawals++;//increments # of withdrawals
}

//method calculates interst
public void calcInterest()
{
double mir = (rate/12);//monthly interest rate
double minterest = balance * mir;//dollar maount
balance += minterest;//adds interest to balance
}

//method does monthly resets
public void monthlyProcess()
{
balance -= charges;
calcInterest();
charges = 0;
withdrawals = 0;
deposits = 0;
}

}

Explanation / Answer

please rate - thanks

part 1 was partially done

withdrawls should be int

public class SavingsAccount extends BankAccount
{private boolean status;   
public SavingsAccount(double balance,double rate)
    {super(balance,rate);
        if(balance<25.0)
            status=false;
        else
            status=true;       
        }
public void deposit(double amount)
    {super.deposit(amount);
        if(!status)
        if(getBalance()>=25)
                status=true;
    }
public void withdraw(double amount)
    {if(status)
        {super.withdraw(amount);
            if(getBalance()<25)
                status=false;
        }
    }
public void monthlyProcess()
    {double amt;
    if(getWithdrawals()>4)
       {amt=getCharges();
        setCharges(amt+(getWithdrawals()-4));
         super.monthlyProcess();
        setCharges(amt);
        }
        else
            super.monthlyProcess();           
    }
}

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

public abstract class BankAccount
{
public double rate; //interest rate
public double balance;//balance
public double withdrawals; //withdrawals
public double charges; //service charges
public double deposits; // #of deposits

public BankAccount(double bal, double ir)//constructor receives balance and interest rate.
{
balance = bal;
rate = ir;
}

//method to accept the amount of the deposit as an argument, it then increments the # of deposits and adds the deposit to balance.
public void deposit(double dep)
{
balance += dep;// adds amount of deposit to balance
deposits++;//increments the amount of deposits
}

//method accepts arugment for the amount of withdarawl, subtracts it from balance
public void withdraw(double wd)
{
balance -= wd;//subtracts withdrawal amount from balance
withdrawals++;//increments # of withdrawals
}

//method calculates interst
public void calcInterest()
{
double mir = (rate/12);//monthly interest rate
double minterest = balance * mir;//dollar maount
balance += minterest;//adds interest to balance
}

//method does monthly resets
public void monthlyProcess()
{
balance -= charges;
calcInterest();
charges = 0;
withdrawals = 0;
deposits = 0;
}
public double getBalance()
{return balance;
}
public double getWithdrawals()
{return withdrawals;
}
public double getCharges()
{return charges;
}
public void setCharges(double c)
{charges=c;
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote