Chinese Zodiac

[Banner Ad]





Conditional Statements and Looping Structures

If...Else Statement   Switch Statement   While Loop   For Loop


If...Else Statement

This script allows the user to input a 4-digit birth year between 1912 and 2011. It determines what the Chinese Zodiac sign is for that year using if...else logic. A symbol is displayed for that sign and a file is updated with the number of people who have entered that year.
[Test the Script]   [View the Source Code]


Switch Statement

This script allows the user to input a 4-digit birth year between 1912 and 2011. It determines what the Chinese Zodiac sign is for that year using switch logic. A symbol is displayed for that sign and a file is updated with the number of people who have entered that year. In addition, the script will display the name of a President who shared the same zodiac sign as well as the years for that sign between the date of 1900 and 2031.
[Test the Script]   [View the Source Code]


While Loop

This script displays a table of the 12 Chinese Zodiac signs with an image for each sign and the birth years for each sign. It uses while logic to build the table.
[Test the Script]   [View the Source Code]


For Loop

This script displays a table of the 12 Chinese Zodiac signs with an image for each sign and the birth years for each sign. It uses for loop logic to build the table.
[Test the Script]   [View the Source Code]


Home Page  Site Layout  Control Structures  String functions  Web Forms
Midterm Assessment  State Information  User Templates  Final Project