Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases

Authors: Ian Robinson, Jim Webber, Emil Eifrem

1st Edition

1449356265, 978-1449356262

More Books

Students also viewed these Databases questions