1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
#include <iostream>
#include <math.h>
#include <string>
#pragma once
namespace Project1 {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace std;
/// <summary>
/// Summary for calculate
/// </summary>
public ref class calculate : public System::Windows::Forms::Form
{
public:
calculate(void)
{
InitializeComponent();
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~calculate()
{
if (components)
{
delete components; }}
private: System::Windows::Forms::TextBox^ boxRentPayment;
private: System::Windows::Forms::TextBox^ boxNumberOfPayment;
private: System::Windows::Forms::TextBox^ boxNumberOfYear;
private: System::Windows::Forms::TextBox^ boxLoanIntrest;
private: System::Windows::Forms::TextBox^ boxMaturityIntrest;
private: System::Windows::Forms::TextBox^ boxHousePrice;
...
#pragma endregion
private: System::Void label1_Click(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void label5_Click(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void label7_Click(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void label8_Click(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void label11_Click(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void label16_Click(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
double rentPayment,intrestRent,intrestHouse,monthlyPayment,intrestRateLoan,intrestRateMaturity,housePrice,loanAmount,numberOfPayment,numberOfYear,rentTotal,investTotal,houseValue,paymentTotal,intrestLoan,intrestMaturity,moneyHad;
double A,B,C,D,E;
rentPayment = System::Convert::ToDouble(boxRentPayment->Text);
intrestRateLoan = System::Convert::ToDouble(boxLoanIntrest->Text);
intrestRateMaturity = System::Convert::ToDouble(boxMaturityIntrest->Text);
housePrice = System::Convert::ToDouble(boxHousePrice->Text);
numberOfPayment = System::Convert::ToDouble(boxNumberOfPayment->Text);
numberOfYear = System::Convert::ToDouble(boxNumberOfYear->Text);
moneyHad = System::Convert::ToDouble(boxMoneyHad->Text);
intrestLoan= (intrestRateLoan/100);
intrestMaturity= (intrestRateMaturity/100);
intrestRent= (intrestRateMaturity/100);
intrestHouse= (intrestRateMaturity/100);
loanAmount = housePrice - moneyHad;
A = (pow ((1 + intrestLoan) , numberOfPayment));
B = (intrestLoan * A);
C = (A - 1);
D = (B / C);
monthlyPayment = D * loanAmount;
E = pow ((1 + intrestMaturity),numberOfYear);
investTotal = moneyHad * E;
paymentTotal = monthlyPayment * numberOfYear;
houseValue = housePrice * ( pow ((1 + intrestHouse), numberOfYear));
rentTotal = rentPayment * ( pow ((1 + intrestRent), numberOfYear));
boxRentTotal->Text = System::Convert::ToString(rentTotal);
boxInvestTotal->Text = System::Convert::ToString(investTotal);
boxHouseValue->Text = System::Convert::ToString(houseValue);
boxPaymentTotal->Text = System::Convert::ToString(paymentTotal);}
private: System::Void rentPayment_TextChanged(System::Object^ sender, System::EventArgs^ e) {}
private: System::Void investAmount_TextChanged(System::Object^ sender, System::EventArgs^ e) {}
private: System::Void calculate_Load(System::Object^ sender, System::EventArgs^ e) {}
};
}
|