Exercise One

Implement a web page to receive a number and continue receiving numbers until a zero is entered. When a zero is entered, the program should output how many positive and how many negative numbers have been entered, and then stop.

1. In this exercise you need at least three files (ex2.html, ex2.css, ex2.js).

2. You need an input tag with type 'text', because this program receives a number and a proper html tag to show the result.

3. Use proper styles for your html document.

Exercise Two

Implement a program to receive a positive number and output "yes" if it's equal to its reverse; otherwise, output "no". For instance, if the input is 63936, the program should output "yes", because if you read the digits from left to right or from right to left, it's the same number. But, if the input is 632, the program should output "no" because 632 is not the same as 236.

You may separate the digits of the input number and make the reverse of the input number along the way - i.e., in loop iterations. For instance, assume the input number is 235, before entering the loop, you should declare a variable 'reverse' and initialized it to 0 as well as storing the input number in a variable, let's call it temp.

In the first iteration of the loop, you will have:

235 modulus 10 is 5; and, the reverse number that you currently have, which is 0, times 10 plus 5 is 5 and you store it in variable reverse; then, you reduce 235 to 23 by dividing it by 10.

Now, in the second iteration of the loop, you will have:

23 modulus 10 is 3; and, the reverse number that you currently have, which is 5, times 10 plus 3 is 53 and you store it in variable reverse; then, you reduce 23 to 2 by dividing it by 10.

Now, in the third iteration of the loop, you will have:

2 modulus 10 is 2; and, the reverse number that you currently have, which is 53, times 10 plus 2 is 532 and you store it in variable reverse; then, you reduce 2 to 0 by dividing it by 10.

Because the number is already reduced to zero, there is no more iteration. In other words, we exit the loop. Now, we should compare the initial number (235) by its reverse (532)that we built within loop iterations. If they are equal, we output "yes"; otherwise we output "no".

Exercise Three

Create 100 boxes at random locations inside a div with the id container (see below). When the mouse moves over a box, the box should be removed from the div. When the div has onechild box, pop up an alert that says, "last child!".

Add a button to create more boxes. If the user clicks on the button, your JS code should generate 100 more boxes (even if you have existing boxes on the screen).

Figure: see image.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.