Threesuns

Email the Instructor

Contact

All Semesters

Semesters

All Courses

Courses

2015Spring

01.12.15 - 05.10.15

Scripting (Online)

CSYS2033


12:00 AM - 12:00 AM

Planet Weight Calculator

Lab05

Objective: To understand and use control structures, functions, events, and arrays

pastdue

Submit Your Solution

Lab05

Requirements

Webpage properly formed and Valid10 pts
All parts of the page are present10 pts
Image is changed with user selection20 pts
Users weight is calculated correctly20 pts
Error is displayed is no weight is entered20 pts
Pluto exception functions properly20 pts
Total100 pts

Instructions

For this assignment you will need to create a single HTML file that will display a page that will allow a user to enter their weight on Earth and will then calculate what that persons weight would be on the other eight planets (plus Pluto) in our solar system and display a picture of the planet that has been selected.

The page that is created should contain the following parts:

1 Image - The image should be of the planet that is currently selected with the select component.

1 Select - This should be a single selection SELECT tag that lists all eight of the planets (plus Pluto) in our solar system. Earth should be selected by default.

1 Text field - This component should be used for allowing the user to enter their 'Earth weight'.

1 Text area - This component will be used to output.

Overview:
When the user selects a planet from the select component a JavaScript function should be called. This function may then call other functions. In this function(s) the image that is displayed should be changed to the image of the currently selected planet (see graphic section below) and the weight should be calculated from the users earth weight that was entered in the 'Earth weight' text field (see weight section below).

Weight: If no weight has been entered in the 'earth weight' text field then the function that is called when a new planet is selected from the planet select box should display a message in the output text area that instructs the user to enter their weight in the 'earth weight' text field to see the calculated weight for the selected planet (use the selected planets name in the message).

If the user has entered their weight in the 'earth weight' text field that value should be used to calculate their weight on the selected planet anytime a new planet is selected and then that weight should be displayed in the output text area. If the planet that is selected is Pluto (actually a dwarf planet) then a message should be displayed in the output text area that informs the user that there is currently not enough known about Pluto to calculate their weight.

To find what a person would weigh on a planet, multiply their Earth weight by one of the following values depending on the currently selected planet.

Planet name Percentage of Earths gravity
Mercury 0.38
Venus 0.91
Earth 1.0
Mars 0.38
Jupiter 2.54
Saturn 0.93
Uranus 0.8
Neptune 1.2
Pluto unknown

Example: If a persons weight on earth was 190 lbs. Then multiplying 190 by 0.38 would give their weight on Mercury or Mars which would be 72.2 lbs. The units of weight (lbs or kg) are not important.

Graphic:
The images of the planets to be displayed can be downloaded with this assignment. When a user selects a planet from the select component, the image of that planet should be displayed. Earth (planet3.jpg) should be displayed by default. You are welcome to use your own pictures if you would like but make sure you include your images in your final lab when it is turned in.