Question: Assignment 3: Conditions in JavaScript Objectives Understanding conditional expressions in JavaScript. - Create websites that take in input via HTML Input forms and put that
Assignment 3: Conditions in JavaScript
Objectives
Understanding conditional expressions in JavaScript. - Create websites that take in input via HTML Input forms and put that information back out to the screen in various ways.
question 1
Everything in this question should go in the q1 folder. The file should be named index.html.
Make the title of this section: (Your Name)s Smallest of Three Numbers
This will be identical to the previous question, except with three inputs!
Include the necessary HTML documentation using comments. Include your name, class number, section number, and date.
Create these empty div element(s) on the screen: results
Put three input text boxes on the screen and a button. Label the first box as Enter the first number, the second, Enter the second number, and the third, Enter the third number. Put a button on the screen with the text that reads, Determine the smaller number.
When the user enters three numbers and clicks the button, the results div box should print which of the three numbers is the smallest (First or Second or Third) along with the actual number. Write your output as a complete sentence, such as The third number (102) is smallest.
This question will be tricky because sometimes youll get (4, 4, 3), and one number is the smallest. Sometimes youll get (4, 5, 4), and two numbers will be the smallest. If two numbers are equal and smallest than a third, print that one of the numbers is the smallest. If all three numbers are the same, print the first value.
question 2
Make the title of this section: (Your Name)s Middle of Three Numbers
This will be identical to the previous question, except report the middle value! Here, we define a middle number as the number (out of three total) that is not larger than the largest and not smaller than the smallest.
Create these empty div element(s) on the screen: results
Create these empty div element(s) on the screen: results
Put three input text boxes on the screen and a button. Label the first box as Enter the first number, the second, Enter the second number, and the third, Enter the third number. Put a button on the screen with the text that reads, Determine the middle number.
When the user enters three numbers and clicks the button, the results div box should print which of the three numbers is in the middle (First, Second, or Third) along with the middle. This application should write the output as a complete sentence, such as The first number (18) is the middle value.
What if all three numbers are the same? Print the only number.
question 3
Make the title of this section: (Your Name)s Even, Odd, Float, or None of the Above.
Create these empty div element(s) on the screen: results
Put an input text box on the screen and a button. Label the box as Enter anything:. Put a button on the screen with the text that reads, Determine the type of number.
When the user enters a number and clicks the button, the results div box should print if this is even, odd, a floating-point number, or none of the above. Here are some examples:
1: Odd
4: Even
5.5: Float
Fido: None of the Above
question 4
Make the title of this section: (Your Name)s Nearest Integer. This application rounds numbers.
Assume you are given a number with values after the decimal point, such as 3.14. Is 3.14 nearest to 3 or 4? Your program should figure this out.
You can get the lower integer of any positive floating point value using parseInt. You can get the higher integer by simply taking the lower value and adding 1.
Determine which integer (higher or lower) is closer to your value and print that result.
Create these empty div element(s) on the screen: results
Put one input text box on the screen and a button. Label the first box as Enter the first number. Put a button on the screen with the text that reads, Determine the nearest integer.
When the user enters a floating-point number and clicks the button, the results div box should determine the nearest integer. The nearest integer is 3.
To make this problem a little easier, assume that the user will only enter a positive number.
There is a function called Math.round that can do this for you. Do not use it.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
