Javascript Code Using If Else to Compute Discount based on Grades

<html>
   <body>
   
      <script type = "text/javascript">
         <!--
var grade= prompt("Enter grade"); 
var tuition=prompt("Enter tuition fee");
           if (grade>=99) 
            {
               discount=tuition *1;
               document.write("<b> COngrats You Deserved 100% Discount " ); 
            }       
    else if(grade >=95)     
            { 
               discount=tuition *.50;
               document.write("<b> COngrats You Deserved 50% Discount " ); 
             } 
    else if(grade >=93)     
            { 
               discount=tuition *.25;
               document.write("<b> COngrats You Deserved 25% Discount " ); 
             } 
             
    else {
               discount=0;
               document.write("<b> Sorry you are not  Qualified for  Discount " ); 
     
       }
     
             document.write("<br><b> Tuition Fee " +tuition);
             total=tuition-discount;
            document.write("<br><b> Discount " +discount); 
             document.write("<br><b> Total Fee " +total);
            
               
</script>
</body>
 </html> 

Comments

Popular posts from this blog

Javascript Code using getElementById and If Else Statement