The task is to measure whether the IQA is good or bad. IQA is a measure of the air quality index. This measurement is made in conjunction with the measurement of two gases: O3, PM10. So you have a table to keep track of if the index is good or bad.
O3 PM10
Índice Maximo Maximo
Muito Bom 59.4 19.4
Bom 119.4 34.4
Medio 179.4 49.4
Fraco 239.4 119.4
Ruim >239.5 >119.5
NOTE: The IQA will be determined by the worst index. When O3 is "bad" the IQA will be "bad". Likewise when PM10 is poor the IQA will be "bad". The worst index will determine the IQA
Here is my code. However my doubt is that this code works but it always writes that it is "VERY GOOD" and I am not sure how to fix it.
<head>
<title>CalculoDeIQA</title>
<meta charset="UTF-8"/>
</head>
<body>
<h1>Forneça o indice de PM10 e 03 para o cálculo do IQA </h1>
PM10:<input type="text" name="PM10" id="PM10id">
<br>
O3: <input type="text" name="O3" id="O3id" >
<br>
<br>
Enviar: <input type="submit" name="enviar" onclick="calculaIqa()">
<script language="JavaScript">
var O3=document.getElementById("O3id");
var PM10=document.getElementById("PM10id");
function calculaIqa(){
if((O3>=239.5) || (PM10>=119.5)){
document.write("IQA ruim ");
}
if((O3>=239.4) || (PM10>=119.4)){
documento.write("IQA fraco");
}
if(O3>=179.4||PM10>=49.4){
document.write("IQA medio");
}
if((O3>=119.4)||(PM10>=34.4)){
document.write("medio");
}
if((O3>=59.4) || (PM10>=19.4)){
document.write("IQA bom");
}else{
document.write("IQA Muito Bom");
}
}
</script>
</body>
</html>