Threesuns

Email the Instructor

Contact

All Semesters

Semesters

All Courses

Courses

2015Fall

08.18.14 - 12.14.14

Scripting (Blended)

CSYS2033

Wednesday
01:00 PM - 02:20 PM

Find Rectangular Area

Lab02

Objective: To use JavaScript variables and operators to find the area of a rectangle.

pastdue

Submit Your Solution

Lab02

Request a Copy of your Solution

Lab02

Requirements

Page is well formed and valid20 pts
Script allows the entering of two values with the prompt function20 pts
Script recognizes when the users input is incorrect and displays an error30 pts
Script does not display the area when inputs are not correct10 pts
Script correctly calculates the area when all inputs are correct20 pts
Total100 pts

Instructions

For this lab you will need to allow the user to enter the width and height of a rectangle and then calculate the area for that rectangle and display it for the user.

You will need to use the JavaScript prompt function to allow the user to enter the width and height of a rectangle. Two separate prompts should be used to do this. Keep in mind that when the user is shown the prompt dialog boxes they may enter a number as they are expected to, they may press OK without entering anything, or they may press the cancel button.

In the case where the user doesn't enter a number in one or both of the two prompt boxes, your scripts should recognize what has happened and display an error message with the alert function for the user.

If the user does enter two numbers as the script expects, the script should multiply those two numbers together to find the area of the rectangle and then display that area using the alert function for the user. The area should not be displayed unless the user's inputs were valid.