Question: Now enter two numbers and click on the enter button, nothing happens. Now, add an event to the button such that when it's clicked you

Now enter two numbers and click on the "enter" button, nothing happens. Now, add an event to the button such that when it's clicked you handle that event by the twoNumbers) function in your js file.

Complete the function two umbers), implementing/translating the flowchart you did for Ex0. (a>b) or (b>a) or they are qual

* i am giving the html and java script code below

------html------

EECS1012: Lab 4 - Computational Thinking

two numbers

one number

another number

© Author(s): SM Tausif

------javascript------

/* Webpage HTML document for Lab 4.

For: EECS 1012 23w n, York University, Lassonde School of Engineering (LAS)_*/

// for Ex1 to Ex6, change the name of the following function properly

function twoNumber() {

//precondition: w, h belongs to whole numbers

//postcondition: larger is calculated and outputted, or 'they are equal' if they are equal

var a =document.getElementById("number1").value;

var b =document.getElementById("number2").value;

/* in Ex1 to Ex6A, you need to rename "twoNumber" to make it appropriate

for those problems, you may also need to add

variable that you might have in your formulas above */

/* in Ex6A mappingA() do sth like

var a = ...;

if(a >= 90)

answer = "A+";

else if (a>=80)

answer = "A";

else if ....

*/

document.getElementById("output").innerHTML="larger: " + Math.max(a, b);

}

/* in Ex6B for mappingB() ,

function mappingB(){

uncomment and complete this block

var a = ...

switch (true){

case (a>=90):

answer="A+";

break;

case (a>=80):

answer="A";

break;

// you need to add more cases for other letter grades

default:

answer="F";

}

}*/

function changeColorover() {

document.getElementById("butn").style.color = "red";

}

function changeColorout() {

document.getElementById("butn").style.color = "DarkSlateGrey";

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!