Help me do a small easy assignment about JavaScript and HTML.
CS 1011b - The Internet: Behind the Curtain Assignment 3 Instructor: L. Magguilli Due Date: April 06, 2017, 11:55pm Total marks: 100 Percentage of final mark: 15% Accepted up to ONE (1) day late. Project 1: Use JavaScript imbedded in HTML [15 marks] Using a plain text editor (example: NotePad or Notepad++ or Brackets), create a web page that contains JavaScript code by typing in the HTML tags and JavaScript commands as shown in the lecture notes and in class. The web page must look exactly as shown [You MUST use these words and spacing]: Everything above and below the horizontal lines is plain HTML code. Everything between the two lines is JavaScript. The number to be formatted must be: 987654321. You will include the following function in your web page to add the appropriate commas: // This simple method adds commas to numbers (thousands, millions …) function formatNumber(num) { return num.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,") } The JavaScript will test if JavaScript is enabled by using the tag as shown in class:
If JavaScript is not enabled, the following text should appear:
Project 2: Using JavaScript to interact with a user and the use of Function Calls [25 marks]
Using a plain text editor (example: Brackets or Notepad or Brackets), create a web page that
contains JavaScript code by typing in the HTML tags and JavaScript commands as shown in the
lecture notes.
You will ask the user if they wish to draw the Mandelbrot Set.
If they do, you must prompt for the number of iterations (how fine of detail) they want.
Then you will render the Mandelbrot Set on your webpage.
If they enter a value less than 100, or greater than 5,000 or decline, you will display the fact the
user declined on to the webpage.
The rendered webpage must look like this [You MUST use these words and spacing]:
Everything above and below the horizontal lines are plain HTML code.
Everything between the two lines is JavaScript.
The JavaScript for the Mandelbrot Set is in a supplied file named Mandelbrot.js
You must set up the connection inside your webpage to this file so the included function can be
called from your JavaScript code: [do NOT copy the code in to your webpage]
The function is:
Mandelbrot( 450,300, -2,1, -1,1, NumIterations );
where NumIterations is the value your user enters.
Just copy and paste the line of code above into your code exactly as given here.
Note: the higher the number of iterations – the longer it takes to render the set.
First, you must confirm with the user they want to render the Set.
The confirmation message must look like:
If they Cancel – display the following:
If they accept, then prompt them for the number if iterations.
Project 3: Using JavaScript to compute and display the Professor Magguilli Retirement
Fund [40 marks]
Prf. Magguilli always talks about the power of doubling values and how quickly it accumulates.
One example he frequently uses is if the class starts with a penny and then doubles it every day,
how much will he accumulated each day. This means add the result to a running total.
The Magguilli Retirement Fund is a series of numbers based on multiplying the next sequential
number by two (double the number at each step).
Simply stated:
Start with a value A and a running total X that starts with the value of A
Double this value A (A x 2 = B) then add B to the running total of X
Then Double B (B x 2 = C) then add C to the running total of X
Then Double C (C x 2 = D) then add D to the running total of X
( write code that allows you to do this with just two (2) variables. )
The rendered webpage must look like this [You MUST use these words and spacing]:
Your results must be formatted using the FORMATTING INSTRUCTIONS:
- The Number of Iterations must be displayed before the results (as seen in the first image).
- All equations MUST line up
- so: as the DAY goes from single digit to two – the spacing must make room
- DAY Number: must be in bold – but the equations not bolded (plain)
- All numbers must have the appropriate commas inserted.
- (hint: you have seen this before…)
- The dollar sign ($) is added as part of the text output line.
HINT: to show a number with EXACTLY two (2) decimal places in JavaaScript add .toFixed(2)
so –if you name the variable that stores the number is something like imaVaribale
then the following will show it with two decimal places: imaVaribale.toFixed(2)
PROMPT: You must prompt the user for the number of iterations they wish to see computed:
The prompt must look like:
Everything above the second horizontal line and below the third horizontal line is plain HTML
code.
Everything between the bottom two lines is JavaScript.
You need to test if the user has entered a zero (0) or a negative number or has Canceled the
request or entered a number out of range.
If the user does any of these actions you will simply print this information out on the webpage as
seen in the image below.
Example of Screen when user cancels or enters an invalid entry:
Project 3 BONUS: [10 additional (bonus) marks]
This is an optional addition to the Project Three (3) for bonus marks (added to the assignment
grade)
The class wants to know how many days have to pass before $1,000,000.00 is reached.
Add code to the web page that will send an alert message to the user when this milestone is
achieved.
BUT!! This message must only appear once, even if more days beyond this point are calculated.
SO, if this goal is reached on day 26, this message should only appear once. It cannot repeat or
be shown again. Once and once only!
This is what the BONUS pop up message must say, exactly.
Only show this prompt at when the total accumulated of one million dollars reached.
Do not show any message or prompt if the number of iterations is too low to reach the one
million mark.
If you elect to do the bonus do NOT submit two different copies of Project Three.
The Teaching Assistants will be able to see you attempted the bonus by looking at the code.
Project 4: Publish your Web Pages [10 marks]
Go to the web site http://publish.uwo.ca/ to get step by step instructions for posting a web page
at Western. Complete the instructions provided at this site.
Upload the following files to that site:
- youraccountname_Project1.html
- youraccountname_Project2.html
- youraccountname_Project3.html
- Mandelbrot.js
- Any other files that are required for your pages to operate.
Go the following site: http://publish.uwo.ca/~youraccountname/youraccountname_Project1.html
and ensure that your pages are published and work properly
Project 5: Final Exam [10 marks – 2 each]
Write five (5) multiple choice questions you think would be appropriate for the final exam.
Base these questions on material covered in the slides or in class since the midterm.
[The final will not be cumulative]
• Ensure that each multiple choice question has five choices
• Ensure that the majority of questions are framed in a positive context
(do not use questions that ask “Choose the option that does not belong)
• Avoid using “all of the above” or “none of the above” answer options, or answers
consisting of specific option numbers as possible responses.
• Provide, for each question the correct answer
( …and again, if I use your question(s) you will already know the answer(s) )
Submission Instructions:
You must upload and submit, via the CS1011 OWL Web Site, the following file:
youraccountname_Assignment3.docx or youraccountname _Assignment3.doc
- this will contain your Final Exam questions.
youraccountname_Project1.html
youraccountname_Project2.html
youraccountname_Project3.html
Mandelbrot.js (just to make it easier to mark – the file will be included in your download)
Any other files you wrote (you created or used some other files) so your pages work.
- It is your responsibility to have all the file required for your web pages to function.
(example: my UWO email is dernt373@uwo.ca
so, my file name that is to be used for submission is:
dernt373 _Project1.html
-and
dernt373 _Project2.html
-and
dernt373 _Project3.html
NOTE: Please do not cheat.
Do not use another student’s work.
We will check, we will be able to verify.
And besides, you will need to know how to write JavaScript for the final.
So, please, do not cheat. Do the work yourself. Do the work independently.