?? debt.cpp
字號:
#include "Debt.h"
#include "AccDebt.h"
void Debt::GetR(double _R5, double _R30)
{
this->R5=_R5;
this->R30=_R30;
}
double Debt::GetN(double _n)
{
this->N=_n;
if(N<=60) R=R5;
else R=R30;
return N;
}
double Debt::GetT(double _t)
{
this->T=_t;
return T;
}
double Debt::GetP(double _p)
{
this->P=_p;
return P;
}
double Debt::CalP()
{
this->P=T*AccPower(R,N)/AccSumPower(R,N);
return P;
}
double Debt::CalIncrement()
{
this->Increment=N*P-T;
return Increment;
}
void Debt::CalPayTable()
{
int i=0,j=0;
for(i=0;i<30;i++)
{
j=(i+1)*12;
if(i<5)
this->Table[i]=AccPower(R5,j)/AccSumPower(R5,j)*10000;
else
this->Table[i]=AccPower(R30,j)/AccSumPower(R30,j)*10000;
}
}
void Debt::ShowInfo()
{
cout<<"********* The total of debt (unit: Yuan) **********************"<<endl;
cout<<"You totally owe our bank: "<<T<<" Yuan."<<endl;
cout<<"********* The mount of periodics (unit: month) ****************"<<endl;
cout<<"You should pay off all the debt in: "<<N<<" Months."<<endl;
cout<<"********* Pay for each month (unit: Yuan) *********************"<<endl;
cout<<"Each month you should pay: "<<P<<" Yuan."<<endl;
cout<<"********* debt and increment (unit: Yuan) *********************"<<endl;
cout<<"You totally pay our bank: "<<T+Increment<<" Yuan."<<endl;
cout<<"********* Increment (unit: Yuan) ******************************"<<endl;
cout<<"The total Increment is: "<<Increment<<" Yuan."<<endl;
cout<<"********* The below is a paytable with basis 10,000 Yuan ******"<<endl;
cout<<"YEARS "<<"pay-rate "<<endl<<endl;
for(int i=0;i<30;i++)
{
cout.width(3);
cout<<i+1;
cout.width(16);
cout.precision(8);
cout<<Table[i]<<endl;
}
cout<<"***************************************************************"<<endl;
}
double Debt::RemainAft(int nMonth)
{
this->Remain=T*AccPower(this->R,nMonth)-P*AccSumPower(R,nMonth);
return Remain;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -