Example #1
0
/*
   * Calculates depriciation in sum-of-years-digit method
   * returns : Depriciation array of double values
   */
double* Assets::sumOfYearsDigits(){
	double tmpYr = usefulLifeYears;
	double sumYr = sumUptoN(tmpYr);
	double *depriciation = new double[usefulLifeYears];

	for(int i = 0; i < usefulLifeYears; ++i){
		depriciation[i] = assetValue * (tmpYr-- / sumYr);
	}
	return depriciation;
}
int squareOfSum(int n) {
	int ret = sumUptoN(n);
	return ret * ret;
}