function RateCalculator(maximumArg, baseArg, noRound){
	this._sectionArray = new Array();
	this._maximum = maximumArg;
	this._base = baseArg;
	this._nr = noRound;
}

RateCalculator.prototype.addSection = function(greaterThan, maximum, interval, fee){
	this._sectionArray.push({'greaterThan': greaterThan, 'max' : maximum, 'interval' :  interval, 'fee' : fee});
};

RateCalculator.prototype.calculate = function(policyAmount){	
	if(policyAmount > this._maximum){
		return null;
	}
	
	var rate = this._base;
	
	for(var i = 0; i < this._sectionArray.length; i++){
		if(policyAmount > this._sectionArray[i]['greaterThan']){
			var temp = this._nr ? policyAmount : CalcUtils.roundUp(policyAmount, this._sectionArray[i]['interval']);
			temp = Math.min(temp, this._sectionArray[i]['max']);
			rate += ((temp - this._sectionArray[i]['greaterThan']) / this._sectionArray[i]['interval']) *
				this._sectionArray[i]['fee'];
		}
	}
	return rate;
};