His Chinese year (dragon, boar, etc.)(This is an array problem using the year % 12) If the year % 12 is
year%12 | Year of the |
0 | monkey |
1 | rooster |
2 | dog |
3 | pig |
4 | rat |
5 | ox |
6 | tiger |
7 | rabbit |
8 | dragon |
9 | snake |
10 | horse |
11 | sheep |
Aside from using arrays and functions, this project is important because it is complex enough that you must write it one step at a time.
You can start with any step you understand, but this is an example.
You may start with an array of the Chinese zodiac signs, then input a year and print the sign.
You may start by assuming that the date is valid, then test for a valid date later, but this must be part of the final program.
- Check that the month is between 1 and 12
- Check that the number of days is valid for the month.
- Of particular concern is Feb. 29. This is valid only if the year
is a leap year.
A year is a leap year if it is divisible by 4, but not by 100, unless
it is also divisible by 400.
Leap year reference
This is a fun and interesting project that combines some of the skills you have learned. It is not important whether you believe in Astrology or not.
Check List:
- Your program starts with comments giving your name and the name of the assignment.
- Your program uses good variable names.
- You have used arrays whereever appropriate.
- You have used functions for all parts of the computations.
- All functions have a comment telling what the function does.
- All input has a good prompt so that the user knows what to enter.
- All output clearly describes what is output.
- You have checked for invalid dates, including Febrauray 29 for leap year and not leap year.
- The program must be your own work.
- You have created a Word document with your name, the name of the project, the source code, and screen shots showing good test data.
- You have submitted both the Word document and the Java file in Blackboard.
Grading Rubric
Rubric |
Points |
Program works correctly, no errors |
5 |
Comments, good names, indented |
1 |
Arrays are used wherever appropriate |
2 |
Word document and Java File |
1 |
Screen shots show good test data |
1 |
Sample output: (Your output does not need to look exactly like this.)
This is a test of leap year date:
Here is an example where an invlid date is entered:
This web site, and all pages therein, are the sole property and responsibility of Zebra0.com.
It is not endorsed, sponsored, or provided by or on behalf of Montgomery College.