9일 차 class로 원리금 균등상환 만들기
class Loan {
private double money; // 대출원금
private double profit; // 대출이율
private double month; // 개월 수
public double getMoney() {
return money;
}
public void setMoney(int money) {
this.money = money;
}
public double getProfit() {
return profit;
}
public void setProfit(int profit) {
this.profit = profit;
}
public double getMonth() {
return month;
}
public void setMonth(int month) {
this.month = month;
}
@Override
public String toString() {
return "Loan [money=" + money + ", profit=" + profit + ", month=" + month + "]";
}
public double rePayment() {
double result, result2, top, top2;
top = money * (profit / 12);
top2 = Math.pow(1 + profit / 12, month);
result2 = money * profit * month / 12;
return result2;
}
public double reProfit() {
this.profit = profit / 100.0;
double result, result2, top, top2;
top = money * (profit / 12);
top2 = Math.pow(1 + profit / 12, month);
result = (top * top2) / (top2 - 1);
return result;
}
public double rePay(double io) {
double result;
result = month--;
return result;
}
}