$35
Page 1 of 2
CSI3140
ASSIGNMENT 2
Due Date: Upload your completed assignment file (in .zip format) to this course
website (on Virtual Campus – Brightspace) by 01:00 PM on Monday, June 07, 2021.
Instructions:
• This assignment has 2 pages and must be done individually. It consists of 7
questions with the mark for each question indicated below, resulting in 75 marks in
total.
• Late assignments will NOT be accepted: They will receive a grade of zero.
• Save your answer to each question in a separate file and name it using the following
format: AssignmentNo_QuestionNo_YourLastName_YourStudentID
For example, John Smith, whose student ID is 1234567, should save his answer to
Question 1 in an HTML file named: A2_Q1_Smith_1234567.html
• Create a cover page in Word (or PDF) format containing your full name, student ID,
course number, and assignment number. Name your cover page as
A2_CoverPage_YourLastName_YourStudentID.docx (or .pdf).
• Zip all your answer files together with your cover page into a single .zip file and
name it A2_YourLastName_YourStudentID.zip, and upload that .zip file to this course
website by the due time and date above.
1. Write an embedded CSS rule using the style element that changes the color of all
elements containing attribute class = “greenMove” to green and shifts them down 25
pixels and right 15 pixels. Your html document must contain the necessary elements
to demonstrate the effect of the CSS rule. [10 marks]
Note: For each of the Questions 2, 3 and 4 below, build and render a web page that makes
the indicated effect(s) appear. Validate your page with the following validators:
For CSS3: http://jigsaw.w3.org/css-validator/ (under More Options > Profile,
select CSS level 3). Some CSS3 properties may not validate because they are not
yet standardized.
For HTML5: http://validator.w3.org/#validate-by-upload
Also, test your page with as many browsers as possible (e.g., Internet Explorer, Firefox,
Google Chrome, and Safari).
2. Make a navigation button using a div element with a link inside it. Give it a border,
background, and text color, and make them change when the user hovers the mouse
over the button. Use an external style sheet. [10 marks]
3. Create a div element with a width and height of 500px. Create a radial gradient with
three colors. Start the gradient in the bottom-left corner with the colors changing as
they move along the gradient line to the right. Make use of vendor prefix syntax for
WebKit- and Mozilla-based browsers, as well as the standard CSS3 syntax. [10
marks]
Page 2 of 2
4. Create an infinite animation of an element moving in a square pattern. Make use of
vendor prefix syntax for WebKit- and Mozilla-based browsers, as well as the standard
CSS3 syntax. [10 marks]
Note: The remaining questions require JavaScript programming. Your code should be
well written (e.g., variables declared, meaningful variable names, easy to understand and
no confusing shortcuts, meaningful functions, and useful comments, etc.).
5. Write a script (embedded in an HTML5 document) that reads in two integers and
determines and outputs HTML5 text that displays whether the first is a multiple of the
second. [10 marks]
6. A palindrome is a number or text phrase that reads the same backward and forward.
For example, each of the following five-digit integers is a palindrome: 12321, 55555,
45554 and 11611. Write a script (embedded in an HTML5 document) that reads in a
five-digit integer not starting with zero and determines whether it is a palindrome. If
the number is not five digits long, display an alert dialog indicating the problem to
the user. Allow the user to enter a new value after dismissing the alert dialog. [10
marks]
7. A mail-order house sells five different products whose retail prices are as follows:
product 1, $2.98; product 2, $4.50; product 3, $9.98; product 4, $4.49; and product 5,
$6.87. Write a script (embedded in an HTML5 document) that reads a series of pairs
of numbers as follows:
a) Product number
b) Quantity sold
Your program should use a switch statement to determine each product’s retail price,
and should calculate and output a table that displays the total sales for each of the five
products. Use a prompt dialog to obtain the product number and quantity sold from
the user. Use sentinel-controlled loop to determine when the program should stop
looping and display the final results. [15 marks]