最好的应用市场_建设工程施工合同2021范本_手机企业年报网上申报入口_鞍山人力资源和社会保障局
int main(){double principal;// Loan amountdouble annualInterestRate;// Annual interest rate in percentageint years;// Loan term in yearsint repaymentOption;// Repayment option (1 for Equal Principal, 2 for Equal Installments)int frequency;// Repayment frequency (e.g., 12 for monthly, 4 for quarterly, 2 for semi-annually)cout <<"Enter the loan amount: ";cin >> principal;if(!validateInput(principal)){cerr <<"Invalid loan amount. Must be greater than zero."<< endl;return1;}cout <<"Enter the annual interest rate (in percentage): ";cin >> annualInterestRate;if(!validateInput(annualInterestRate)){cerr <<"Invalid annual interest rate. Must be greater than zero."<< endl;return1;}cout <<"Enter the loan term (in years): ";cin >> years;if(!validateInput(years)){cerr <<"Invalid loan term. Must be greater than zero."<< endl;return1;}cout <<"Choose repayment option (1 for Equal Principal, 2 for Equal Installments): ";cin >> repaymentOption;if(repaymentOption !=1&& repaymentOption !=2){cerr <<"Invalid option. Choose 1 or 2."<< endl;return1;}cout <<"Choose repayment frequency (12 for monthly, 4 for quarterly, 2 for semi-annually): ";cin >> frequency;if(frequency !=12&& frequency !=4&& frequency !=2){cerr <<"Invalid frequency. Choose 12, 4, or 2."<< endl;return1;}double payment;if(repaymentOption ==1){payment =calculateEqualPrincipalPayment(principal, annualInterestRate, years);cout <<"Your average payment (Equal Principal) is: $"<< payment << endl;}elseif(repaymentOption ==2){payment =calculateEqualInstallmentsPayment(principal, annualInterestRate, years);cout <<"Your monthly payment (Equal Installments) is: $"<< payment << endl;}// Calculate total payment and total interestint totalPeriods = years * frequency;double totalPayment = payment * totalPeriods;double totalInterest = totalPayment - principal;cout <<"Total payment over the life of the loan: $"<< totalPayment << endl;cout <<"Total interest paid: $"<< totalInterest << endl;// Generate repayment schedulegenerateRepaymentSchedule(principal, annualInterestRate, years, frequency);return0;">