PowerCenter
- PowerCenter 10.5.6
- All Products
INF_RESULT TxINF_BankSoft::FV() { // Input port values are mapped to the m_pInParamVector array in // the InitParams method. Use m_pInParamVector[i].IsValid() to check // if they are valid. Use m_pInParamVector[i].GetLong or GetDouble, // etc. to get their value. Generate output data into m_pOutParamVector. // TODO: Fill in implementation of the FV method here. ostrstream ss; char* s; INF_BOOLEAN bVal; double v; TINFParam* Rate = &m_pInParamVector[0]; TINFParam* nPeriods = &m_pInParamVector[1]; TINFParam* Payment = &m_pInParamVector[2]; TINFParam* PresentValue = &m_pInParamVector[3]; TINFParam* PaymentType = &m_pInParamVector[4]; TINFParam* FV = &m_pOutParamVector[0]; bVal = INF_BOOLEAN( Rate->IsValid() && nPeriods->IsValid() && Payment->IsValid() && PresentValue->IsValid() && PaymentType->IsValid() ); if (bVal == INF_FALSE) { FV->SetIndicator(INF_SQL_DATA_NULL); return INF_SUCCESS; } v = pow((1 + Rate->GetDouble()), (double)nPeriods->GetLong()); FV->SetDouble( -( (PresentValue->GetDouble() * v) + (Payment->GetDouble() * (1 + (Rate->GetDouble() * PaymentType->GetLong()))) * ((v - 1) / Rate->GetDouble()) ) ); ss << "The calculated future value is: " << FV->GetDouble() <<ends; s = ss.str(); (*m_pfnMessageCallback)(E_MSG_TYPE_LOG, 0, s); (*m_pfnMessageCallback)(E_MSG_TYPE_ERR, 0, s); delete [] s; return INF_SUCCESS; }
#include <math.h> #include <strstream> using namespace std;
#include <math.h> #include <strstream.h>