I have created an algorithm that receives the 4-month bill, which calculates the mean and shows the approval result. For the approval result I did as follows.
Approval Result:
Approval with maximum grade = 10. Approval above average = 8 to 9. Approved on average = 7. Recovery = 6. Failure = 1 to 5.
Problem = If the user enters the value 7 in each note the average will be 7 and will show "Approve on average = 7" However, if you enter the value of 7.3 in each note it will show the following message "Disapproved" in case was to show "Above Average Approval".
I have to convert something to ParseFloat, but I'm not sure where to insert it.
var s1 = prompt ( " Insira a nota do 1 Bimestre : ") ;
var s2 = prompt ( " Insira a nota do 2 Bimestre : " ) ;
var s3 = prompt ( " Insira a nota do 3 Bimestre : " ) ;
var s4 = prompt ( " Insira a nota do 4 Bimestre : " ) ;
var s1 = Number (s1) ;
var s2 = Number (s2) ;
var s3 = Number (s3) ;
var s4 = Number (s4) ;
var media = parseFloat (( s1 + s2 + s3 + s4 ) / 4 );
if (media ==10)
{
alert ( "Aprovação com nota maxima! " ) ;
}
else if ((media == 8) || ( media == 9 ) )
{
alert ( " Aprovação acima da média ! " ) ;
}
else if (media == 7)
{
alert ( " Aprovação com nota na média! " ) ;
}
else if ( media == 6 )
{
alert ( "Recuperação ! " ) ;
}
else
{
alert ( " Reprovado ! " ) ;
}