Hello y’all,
Hope you guys are staying safe and enjoying great holidays.
I’d just like to ask you guys what is the best method to export the “month” element from MortgageCalculator to MortgageReport as shown below in order to see the number of the payment schedule by the month. (Currently, we don’t show the number of the months)
I would really appreciate your help.
public class MortgageCalculator {
public double [] getRemainingBalances() {
var balances = new double [getNumberOfPayment()];
for(short month = 1; month <= balances.length; month++)
balances [month - 1] = calculateBalance(month);
return balances;
}
public class MortgageReport {
public void printPaymentSchedule () {
System.out.println("Payment Schedule: ");
System.out.println("-------------------------");
System. out .println();
for(double balance : calculator.getRemainingBalances())
System.out.println(currency.format(balance));
}