// Specific Heat Capacity Converter 

function SpecificHeatCapacityConverter(unit, value){
	this.uv = new Array(); 
	this.uv = {
		"J/kgC" : 1, // ref unit
		"kJ/kgC" : 0.001,
		"cal/kgC" : 1 / 4.186,
		"kcal/kgC" : 0.001 * 1 / 4.186,
		"btu/lbF" : 0.001 / 4.186
	}
	this.unit = unit; // unit to convert from
	this.value = value; // value to convert
	this.ref = 1 / this.uv[this.unit] * this.value;
}

// returns value for singel unit
SpecificHeatCapacityConverter.prototype.cV = function(unitTo){
	return this.ref * this.uv[unitTo];
}
// returns values for all units
SpecificHeatCapacityConverter.prototype.cVs = function(){
	var msg = this.value + " " + this.unit + " => \n";
	for (var i in this.uv) {
		msg += Math.round(this.ref * this.uv[i] * 1000)/1000 + "  " + i + "\n";
	}  
	return msg;
}

// Copyright engineeringtoolbox.com