How do I exand this for that?


<!DOCTYPE html>

<p>Input the time and click the button:</p>

<input id="time"/>

<button onclick="myFunction()">Try it</button>

<p id="demo"></p> <br>

<p>Input the temperature in degrees Celsius:</p>
<input id="temp"/>
<button onclick="TempConverted()">Click Here</button>

<p id="result"></p>

function myFunction() {
    var hour;
    hour = document.getElementById("time").value;
    if(hour>12 & hour<24){
    	hour -=12;
    	document.getElementById("demo").innerHTML = "It is "+hour+ " pm.";
    }else if(hour==12)
    	document.getElementById("demo").innerHTML = "It is noon.";
	else if(hour==24)
		document.getElementById("demo").innerHTML = "It is midnight.";
	else if(hour >24)
    	document.getElementById("demo").innerHTML = "Invalid Time.";
    	document.getElementById("demo").innerHTML = "it is "+hour+ " am.";

function TempConverted(){
	var temp, far;
	temp = document.getElementById("temp").value;
	if(temp>= -20 & temp<=20){
		far = (temp*9/5.0)+32;
			document.getElementById("result").innerHTML="The temperature "+far+" degrees fahrenheit is freezing point.";
			document.getElementById("result").innerHTML="The temperature "+far+" degrees fahrenheit is above freezing point.";
		document.getElementById("result").innerHTML="Invalid entry.";


I am supposed adapt this to make it do all this:

  • Write a program in Javascript and embed it in an html document.

  • The program should accept as input from the user two numeric inputs each in the range [0-100], to be stored in variables called num1 and num2.

  • The program should then provide as output the results of comparing both values entered by the user; by using all comparison operators specified in Javascript; specifically, <, <=, >, >=, ==, !=.

  • Include messages to the user to indicate the expected range and to clearly indicate the output of your program.

IM NOT ASKING FOR ALL THE HELP. I just truly honestly do not understand what he is trying to tell me to do at all. I am in an intro class and my teacher is not very good at explaining things so we mostly try to pull answers out of our butt. But I can't try with this one because I don't get what I'm supposed to do or how.

Could you tell me what exactly he wants me to do?


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.