The purpose of this assignment is for you to get practice doing “generic” programming activities using JavaScript. Each problem is worth 20% of the grade. You need to:
- Create separate .html files for each of the following JavaScript programming problems below.
Randomly display 1 of 5 images on the screen when the page is loaded. Use whatever (PG) images you’d like.
Create a webpage that has an input <div>, an output <div>, and a button that when clicked it processes the text in the input <div> and places the results in the output <div>. Processing means: List all occurrences of each word along with their count. Matching is case-insensitive. For example (ordering of output is not important):
Input <DIV> The cat ate the bird. The Bird ate the Dog. The dog ate the cat.
Output <DIV> THE 6 CAT 2 ATE 3 BIRD 2 DOG 2
Create a JavaScript program that calculates the maximum, minimum, mean, and median values of a set of numbers as well as the number of even numbers, odd numbers, prime numbers, and power-of-2 numbers. Using prompt pop-up box, ask a user to enter positive numbers one at a time. Also tell them at if they enter a -1 that means they are finished. Display the result in a nicely formatted table in the body of the website.
Create a webpage that has an input <div>, an output <div>, and a button that when clicked it processes the text in the input <div> and places the results in the output <div>. Processing means: converting the Morse Code in the input <div> to English in the output div. Morse code represents characters of an alphabet as sequences of dits (short key closures) and dahs (longer key closures). If we let a period (.) represent a dit and a dash (-) represent a dah, then the Morse code version of the English alphabet is
A .- | G --. | M -- | S ... | Y -.-- |
B -... | H .... | N -. | T - | Z --.. |
C -.-. | I .. | O --- | U ..- | |
D -.. | J .--- | P .--. | V ...- | |
E . | K -.-. | Q --.- | W .-- | |
F ..-. | L .-.. | R .-. | X -..- |
One blank space is used to separate letters and three blanks are used to separate words. Here is an example:
Input <div> Output <div>
-.-. --- ..-. -.-. .-. --- -.-. -.- ... COFC ROCKS
Create a webpage that has an input <div>, an output <div>, and a button that when clicked it processes the text in the input <div> and places the results in the output <div>.
- Processing means: check to see if the input <div> contains a valid email address, which means:
- One or more characters followed by an @ followed by one or more characters followed by a dot (.) followed by one or more characters.
- If the email address is valid display a smiley face pic in the output <div>.
- If the email address is not valid display a frowny face pic in the output <div>
THIS IS INDIVIDUAL WORK ONLY. IF I SUSPECT THE CODE IS NOT YOURS, YOU WILL NEED TO COME TO MY OFFICE TO TAKE A VERBAL TEST ON THE CODE YOU SUBMITTED.