Question #1: Start with the code for the Bouncing Balls (from the Lecture 8 examples – folder HTML5-
1.8). Modify this code to include the following:
a) When you press the Up-arrow key (a Meta Key), the number of objects increase by 10. When
you press the Down-arrow key, the number of objects decreases by 10. Limit the total number
of objects to the range 0-200. When adding objects, randomly add the additional ten objects to
the array. To remove objects, set the array values of the last 10 items to null.
b) Instead of just circles, also create squares and triangles. One way to accomplish this is to
include a variable called type. If type = 0, draw a circle; if 1, draw a square; if 2, draw a triangle.
Of course, you can use whatever method works best for you.
a. Change the radius variable to size.
b. For squares, the x & y can represent the upper left corner. Size is then the width and
c. For triangles, size can represent the radius of a circle into which the triangle fits. Use 90,
210, and 330 degrees as the points on the circle representing the vertices of the triangle
(in other words, use trig to calculate the points).
c) Randomly determine the type of each object.
Question #2: Create a simple AJAX program which will asynchronously fetch two text files from the
server and populate two div tags with the contents of these files.
a) First file is to contain your full name.
b) Second file will contain your favourite quote. Include the author name in tags and on a
separate line at the bottom. Also the author’s name should be a smaller font then the other
text (control this with CSS).
For the code, first call a function to fetch the name. Once it returns, the handler function for this call
should initiate the second asynchronous call and use a second handler function to process its return
value. Use an onload attribute to start the process.
Get professional help with your research essay paper today from our student essay service. For all your Academic Essay/ Research/ Thesis/ Dissertation/ writing needs at an affordable price. 100% authenticity and on-time delivery/ Overnight delivery/ 6 hours delivery. Try our services and we assure you of getting a good grade in your coursework, Term Paper, Research Paper, Thesis, or Dissertation. Order this paper and enjoy a 20% discount today