hey guys i got a problem with my project, the thing is my teacher wants us to use LastInterest but the thing is i dont know what to put in it and then make it work with the other program. The LastInterest is basically the last amount of interest earned.
Please help. thanks in advance

Java Code:
public class SavingsAccount
{
    private double interestRate;
    private double balance;
    private double monthlyRate = interestRate/12;
    private double deposits;
    private double withdraws;
    private double monthInterest;
    

    public SavingsAccount(double balance, double interestRate)
    {
        this.balance = balance;
        this.interestRate = interestRate;
    }
    public void withdraw(double amount)
    {
        balance = balance - amount;  //I dont know if there should be a minus or addition sign so if you know please tell me
        withdraws = withdraws + amount;
    }
    public void deposit(double amount)
    {
        balance = balance + amount;
        deposits = deposits + amount;
    }
    
    public void addInterest()
    {
       balance = balance + monthInterest;    //Im suppose to put the LastInterest here but i dont know what to put.
       
    }
     public double monthInterest()
    {
        monthInterest = balance*monthlyRate;
        return monthInterest;
    }

    public double getBalance()
    {
        return balance;
    }
    public double getInterestRate()

    {
        return interestRate;
    }
    public double getLastInterest()   
     {
        return LastInterest;
     }
    public double getDeposit()
    {
        return deposits;
    }
    public double getWithdraw()
    {
        return withdraws;
    }
   
}
================================================== ====
this is the other code.
Also for this program to work i need to show the total interest earned every month and to make sure the interest is added into the total balance. However, when i run the program the total interest earned every month comes up blank and the total interest isnt showed or added into the total balance
Java Code:
import java.util.Scanner;


public class SavingsAccountTest
{
    public static void main(String[] args)
    {
        double balance;
        double interestRate;
        double months;
        double deposit;
        double withdraw;
        double totalInterestEarned = 0;
        

        Scanner keyboard = new Scanner(System.in);

        System.out.println("What is the starting balance of your account?");
        balance = keyboard.nextDouble();

        System.out.println("What is the interest rate of your account?");
        interestRate = keyboard.nextDouble();

        System.out.println("How many months has it been since you got your "+
        "account?");
        months = keyboard.nextDouble();

    SavingsAccount account = new SavingsAccount(balance, interestRate);



        for(int i = 1; i <= months; i++)
        {
            System.out.println("How much money was deposited into your "+
            "account in month "+i+"?");
            deposit = keyboard.nextDouble();
            account.deposit(deposit);

            System.out.println("How much money did you withdraw from your "+
            "account in month "+i+"?");
            withdraw = keyboard.nextDouble();
            account.withdraw(withdraw);

            System.out.println("The interest earned this month is ");
            account.monthInterest();   // i dont know what to put here. do i need to change the monthInterest to LastInterest.

            totalInterestEarned = totalInterestEarned + account.monthInterest();
        }

        System.out.println("The total amount of deposits was $"+
                account.getDeposit()+". Your total withdrawels in " +
                "your account was $"+account.getWithdraw()+". Your total " +
                "amount of interest earned was $"+totalInterestEarned+". " +
                "Your current balance is "+account.getBalance()+".");
    }
}