/* * House_loan.java * * Created on 17 August 2007 * * The house loan class. */ package loan; /** * * @author merethe */ public class House_loan implements Loan{ int money; int years; Payment payment; /** Creates a new instance of House_loan */ public House_loan(){ //The payment type should be set dynamically Serial_loan payment = new Serial_loan(); this.payment = payment; } /** * Set money * @param money Amount of money */ public void set_money(int money){ this.money = money; } /** * Set years * @param years Number of years */ public void set_years(int years){ this.years = years; } /** * Calculates month payment */ public String calculate(){ String calculation; calculation = "Calculated payback over "+years+" years for a house loan:"; double interest = 3.5; //Could be set dynamically calculation = calculation+this.payment.calculate(years, money, interest); return calculation; } }