CS553: A Table with Graphics and Calculations on the Fly
Refer to pages 637 and 638 in your text "Using Math Methods"
Displaying a Table of Trigonometric Functions will be the basis for this lab.
You will create this table FROM SCRATCH (on the fly).
You will use a FOR loop that will calculate the desired values in 15 degree increments as shown on pages 685, 686, and 687.
You will also provide added functionality to your table. Your table will include a column that will display radians (to the left of the degrees column), a column for sin(x), cos(x) and tan(x) function.
The image below reflects a partial view of the output of the table:
Your table will extend to 360 degrees (2PI radians).
Notes for this assignment:
- When x is 90 degrees AND 270 degrees (PI/2 radians, and 3PI/2 radians respectively), the function tan(x) is UNDEFINED. You will have to place an IF statement in your FOR LOOP to TRAP this condition and place the string "undefined" in the table in these two places
- The greek alphabet is not part of the ASCII character set. Since this is the case, the lower case PI symbol is not directly available for use.
- The data that appear in the column under the radians heading are a set of crude graphic images in zip format and can be downloaded here (right click on this link and select SAVE LINK AS...)
- The images are "numbered" img15, img30, img45, etc., up to img360. These are all .gif images.
- You will use the techniques discussed in class for constructing the javascript command to place these images in the proper place in the row of the table INSIDE THE FOR LOOP...HAND CODING ("cherry picking") IS NOT ALLOWED FOR THIS ASSIGNMENT...
- If you have your own set of images, feel free to use them
- You will limit the output of your calculations to five digits to the RIGHT of the decimal point. This is a link to some examples of how this might be done.
- All elements in ALL cells will be centered.
- Provide enough cell padding so that the contents of the cells have some "breathing room"
- Feel free to colorize the table if you like...DON'T GO CRAZY WITH THE COLOR, AND REMEMBER RULE #1...
Further, please note:
ALL THE WORK (WITH THE EXCEPTION OF THE TABLE HEADER) IS DONE INSIDE A FOR LOOP. PLEASE DO NOT DEVIATE FROM THIS PART OF THE ASSIGNMENT. HAND CODING FOR INDIVIDUAL TABLE ELEMENTS WILL NOT BE ACCEPTED FOR CREDIT!
Last Updated 8 November, 2010