번외. 월세를 얼만큼 내야 이득인가
2024. 12. 19. 21:47ㆍ 로그/1인 가구의 삶
/**
* 전월세 전환 시 월세 보증금 계산
* @param {*} jeonseDeposit 전세 보증금(만원)
* @param {*} monthlyRent 월세(만원)
* @param {*} conversionRate 전월세 전환율(%)
* @returns
*/
const calculateRentDeposit = (jeonseDeposit, monthlyRent, conversionRate = 4.5) => {
// 전월세전환율을 소수점으로 변환
const conversionRateDecimal = conversionRate / 100;
// 월세 보증금 계산
const monthlyRentDeposit = jeonseDeposit - (monthlyRent * 12 / conversionRateDecimal);
// 소수점 둘째 자리까지 반올림
return Math.round(monthlyRentDeposit * 100) / 100;
}
/**
* 대출 가능 금액: 보증금의 80%와 최대 대출 가능 금액(기본값 22200만원) 중 더 작은 금액 반환
* @param {*} deposit 보증금(만원)
* @param {*} maxLoan 최대 대출 가능 금액(만원)
* @returns 대출 가능 금액(만원)
*/
const getPossibleLoanAmount = (deposit, maxLoan = 22200) => Math.min(deposit * 0.8, maxLoan);
/**
* 회사 지원금을 제외한 실제 이자 지출 계산
* @param {*} loanAmount 대출 금액(만원)
* @param {*} lendingRate 대출 금리(%)
* @returns 연 이자(만원)
*/
const calculateAnnualInterest = (loanAmount, lendingRate) => {
if (loanAmount > 20000) {
return loanAmount * lendingRate / 100 - (20000 * 1.5 / 100);
}
return loanAmount * (lendingRate - 1.5) / 100;
}
/**
* 과세 제외한 예금 이자 소득 계산
* @param {*} deposit
* @param {*} depositRate
* @returns 이자 소득(만원)
*/
const getDepositInterest = (deposit, depositRate) => {
return deposit * depositRate / 100 * (1 - 0.154);
}
/**
*
* @param {*} currentJeonseDeposit 기존 전세 보증금(만원)
* @param {*} rentIncreaseRate 보증금 증액율(%)
* @param {*} monthlyRent 월세(만원)
* @param {*} conversionRate 전월세 전환율(%)
* @param {*} lendingRate 대출 금리(%)
* @param {*} depositRate 예금 금리(%)
* @param {*} cash 보유 현금(만원)
* @returns 최종 연간 지출(만원)
*/
const calculateTotalExpenses = (currentJeonseDeposit, rentIncreaseRate = 5, monthlyRent, conversionRate, lendingRate, depositRate, cash) => {
const newJeonseDeposit = currentJeonseDeposit * (1 + rentIncreaseRate / 100);
const monthlyRentDeposit = calculateRentDeposit(newJeonseDeposit, monthlyRent, conversionRate);
const loanAmount = getPossibleLoanAmount(monthlyRentDeposit);
const annualInterest = calculateAnnualInterest(loanAmount, lendingRate);
const expenses = monthlyRent * 12 + annualInterest;
const leftCash = cash - (monthlyRentDeposit - loanAmount);
const depositInterest = getDepositInterest(leftCash, depositRate);
console.log({ monthlyRent, monthlyRentDeposit,
loanAmount,
annualInterest,
expenses,
total: expenses - depositInterest})
// 최종 연간 지출 계산
return expenses - depositInterest;
}
const jeonseDeposit = 31395;
const rentIncreaseRate = 5;
const conversionRate = 4.5;
const lendingRate = 4.04;
const depositRate = 3.03;
const cash = 9195 + 1400;
Array.from({ length: 12 }, (_, i) => i * 10).forEach(rent => {
console.log(calculateTotalExpenses(jeonseDeposit, rentIncreaseRate, rent, conversionRate, lendingRate, depositRate, cash))
});
'로그 > 1인 가구의 삶' 카테고리의 다른 글
저는 이 선반을 기어코 사야겠어요 (2) | 2025.02.04 |
---|---|
05. 월세에서 전세로 가는 여정의 비망록 (0) | 2023.11.30 |
04. 2억 9천9백만원짜리 전세 계약서에 도장을 찍었다 (0) | 2023.01.03 |
03. 집 볼 때 체크리스트 (2) | 2022.03.27 |