EMGT100 Introduction to Engineering
Programming in JavaScript
2
2019 University of Management and Technology
CST 221. Programming in JavaScript
Assignment 3
Instruction:
Building upon knowledge from previous assignments, the purpose of this assignment is to demonstrate your ability to use operators and flow control logic, and to create a function which accepts an input parameter, and uses the data passed to the function.
You can find additional help for this assignment from Module 4 “Operators”, Module 5 “Conditionals” and Module 6 “Looping”.
Create a program that will do the following when run:
1) A window alert appears with the following message “5 is pretty big!”: (Different
owser might display it differently)
2) Once you click ok, the next alert appears “4 is a small number”:
:
3) Once you click ok, the next alert appears “3 is a small number”:
4) Once you click ok, the next alert appears “2 is a small number”:
5) Once you click ok, the next alert appears “1 is a small number”:
Requirements:
You must use a Loop to call a Function 5 times.
Each time the Function will display Window alert “Cu
entValue is pretty big!” or “Cu
entValue is a small number!” depending on the value that was passed as a parameter into the Function. Cu
entValue can be “5” “4”, “3”, “2”, or “1” as passed into the Function from the Loop.
You should have a Conditional Statement inside the Function to determine which message to display after the number: “ is pretty big!” or “ is a small number!”
You can either put all code in one html page, or create one html page and one javascript page like previous assignments.
Use comments and lay the code out so it can be easily followed!
Each file in the assignment must have a comment at the top, using the co
ect commenting technique for the file type, like this:
Your Name
Your Student ID
Course ID
Assignment #
Put all your files in a folder (if you have more than one file), zip it and submit the zipped file.
If you get stuck, feel free to contact the Faculty for assistance at any time.
EMGT100 Introduction to Engineering
Programming in JavaScript
2
2019 University of Management and Technology
CST 221. Programming in JavaScript
Assignment 4
Instruction:
You can find additional help for this assignment from Module 07 “EventHandlers” and Module 10 “Forms”
Create a very simple four function integer calculator with buttons for Add, Subtract, Multiply, and Divide, and with two text-type input fields. When the user enters two numbers and clicks one of the buttons, the answer is displayed where shown.
Your program must use an alert to tell the user about any e
ors. The possible e
ors include:
One or both input fields are blank
One or both input fields < -9999 or greater than 9999
Divide by zero
Illegal character in either input field.
Only 0, 1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 ,9, and – are allowed.
Even though there are none in the example, you must include instructions to the user.
Each file in the assignment must have a comment at the top, using the co
ect commenting technique for the file type, like this:
Your Name
Your Student ID
Course ID
Assignment #
Put all your files in a folder (if more than one file), zip it and submit the zipped file.
If you get stuck, feel free to contact the Faculty for assistance at any time.