0
I created an algorithm that gets a 4-quarter note , which makes an average calculation and shows the result of the approval. For the result of the approval I did as follows .
Result of Approval :
Pass with maximum grade = 10 . Above average approval = 8 to 9 . Approval 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 " Pass on average = 7 " However, if you insert the value of 7.3 in each note will show the following message " Failed " in case it was to show " Pass above average ".
Obs ( I know I have to transform something for 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 ! " ) ;
}
Was any of the answer helpful? Don’t forget to choose one and mark it so it can be used if someone has a similar question!
– Sorack