
/*
Function Quadratique_Solution 
Terme : équation quadratique
*/
function Quadratique_Solution()
{
	var A = parseInt(document.SecondDegre.InputA.value);
	var B = parseInt(document.SecondDegre.InputB.value);
	var C = parseInt(document.SecondDegre.InputC.value);
	
	Rep1 = (-B- (Math.sqrt ((B*B) - (4 * A * C )) )) / (2 * A);
	Rep2 = (-B+ (Math.sqrt ((B*B) - (4 * A * C )) )) / (2 * A);

	document.SecondDegre.Rep1.value = Rep1;
	document.SecondDegre.Rep2.value = Rep2;
}


/*
Function amortissement_mensualite
Terme : amortissement
*/

function amortissement_mensualite()
{
	var capital = document.choix1.capital.value;
	var nombre = document.choix1.nombre.value;
	var taux = document.choix1.taux.value;

// Calcul de l'échéance
	i = taux / 1200.0;
	m = capital*i*Math.pow(1+i,nombre)/(Math.pow(1+i,nombre)-1);

// Affichage du résultat arrondi à deux décimales
	document.choix1.mensualite.value = Math.round(m*100.0) / 100.0;

}


/*
Function amortissement_montant
Terme : amortissement
*/

function amortissement_montant()
{
	var echeance = document.choix2.echeance.value;
	var nombre = document.choix2.nombre.value;
	var taux = document.choix2.taux.value;

// Calcul de l'échéance
	i = taux / 1200.0;
	montant = echeance/(i*Math.pow(1+i,nombre)/(Math.pow(1+i,nombre)-1));

// Affichage du résultat arrondi à deux décimales
	document.choix2.montant.value = Math.round(montant*100.0) / 100.0;

}
