IS202 – Web Development2 (JavaScript)
Information Systems 202
2025
Module Name Web Development (JavaScript)
Practical Number 2
Practical Name Introduction to JavaScript Programming
Date 15 September 2025
Prepared by Dr M Moyo
Declaration
1. I know plagiarism means using another person's work and ideas without acknowledgement
and pretending to be one's own.
2. I am familiar with the University's policy and the Department of Information Systems
guidelines on plagiarism.
3. I know that copying directly from printed or electronic sources and using this material in
assignments is dishonest. Using another student's work and pretending it is my own is also
wrong.
4. I have not allowed and will not allow anyone to copy my work to pass it off as their work.
5. This assignment is my work.
6. I am aware that departments compile a register of plagiarism offenders throughout the
University.
7. I understand I can lose my DP if I plagiarise.
By submitting my practical for assessment, I agree to the above.
Read the entire Instruction Sheet BEFORE attempting the practical
Mark Breakdown
Ex1 pre- Ex2 Ex3 Ex4 Ex 5 TOTAL
practical
Out of 40 10 15 20 20 105
Page 1 of 9
IS202 – Web Development2 (JavaScript)
Learning Outcomes
After completing this practical, the student will be able to:
● Use Math functions
● Write simple JavaScript code to complete operations and display output
● Use different methods including the DOM ones
● Use alert and prompts
● Use variables
Instructions
● Read the entire practical before you start, as exercises may be related.
● Familiarise yourself with the Visual Studio Code and complete the given tasks
● Create a new folder called Practical2 in which to store all this week's exercises.
● Once you have completed an exercise, copy and paste your code into a neatly
formatted MS Word document with clearly labelled headings for each exercise.
You will submit this document for marking via the RUconnected submission link.
Exercises
Question 1:
Marking guide:
Q. 1 Comment Mark Score
1a 8
1b 8
1c 8
1d 16
Total 40
Pre-practical – all in class examples
Page 2 of 9
IS202 – Web Development2 (JavaScript)
Check if each of these JavaScript codes have been codes have been created and
execute.
1a. Either
OR
Page 3 of 9
IS202 – Web Development2 (JavaScript)
1b.
Ic.
1.d.
Page 4 of 9
IS202 – Web Development2 (JavaScript)
And
Page 5 of 9
IS202 – Web Development2 (JavaScript)
LIVE PRACTICAL
Work in Visual Studio Code. Create a folder on your computer and
name it
Question 2.
Create an HTML file called [Link]. Write a JavaScript code to
display the output shown below in a webpage. Your code must utilize five
variables as in the output. Include comments for key code lines Paste
your code and the screenshot of the output in your answer file
[10 mark}
Question 3.
Create [Link] and external JavaScript file called [Link]
Write a JavaScript code in the external file [Link] and reference it
in [Link] file to display the following information in an alert.
Use four variables Length, Width, Perimeter and Area as property of a
rectangle. (Perimeter of rectangle = 2(Length + Width) and Area =
Length * Width. Paste both codes and the screenshot of the output in the
answer file.
[15 marks]
Page 6 of 9
IS202 – Web Development2 (JavaScript)
Question 4
Duplicate both Question 3 and [Link] files as Question 4 and [Link].
Modify the code in [Link] so that it prompts the user to enter both length
and width of the rectangle and display the output as in the picture
. Prompt 1
Prompt 2
Output
Page 7 of 9
IS202 – Web Development2 (JavaScript)
Paste the code referencing the [Link] from the HTML file and the code you
modified in the file [Link] as well the Screenshots of the 2 prompts and the
output [20 marks]
Question 5:
How to calculate profit percentage
a. Compute profit as in the formula
b. Compute Profit Percentage using the second formula
Convert the above formulae to JavaScript statements. Write a JavaScript code in
external file percent_profit.js and reference it in percent_profit.html. Your
application should prompt a user to enter both cost and selling prices, then compute
the profit and % profit is computed.
Use this test data
Cost Price: R6460 Cost Price: R89700
Selling Price: R7850 Selling Price: R78456
Profit: ?
Profit Percentage? ?
Page 8 of 9
IS202 – Web Development2 (JavaScript)
Your output should be in a table at the centre of the screen, light-blue background
and light yellow as shown
Sample input screens
Same Day Submission 17:00
● Place the code for all the exercises in a single MS Word document and upload
it to RUconnected via the practical submission link.
Page 9 of 9