Due: Friday, February 12, 1999
The Mayan civilization used a 365 day calendar, called Haab which had 18 months of 20 days and five days left over. The names of the months are:
pop |
no |
zip |
zotz |
tzec |
zul |
yoxkin |
mol |
chen |
yax |
zac |
ceh |
mac |
kankin |
muan |
pax |
koyab |
cumhu |
For religious purposes, the Mayan civilization used another calendar called Tzolkin. The Tzolkin calendar was divided into thirteen periods, each 20 days long. Hence each "year" was only 260 days long, not 365 days like the Haab year. Whereas the Haab year approximated the the solar year, the Tzolikin calendar precesses radically with respect to the solar year, i.e., the same date in the Tzolkin calendar falls in different seasons of the solar year. We denote each day in the Tzolkin calendar by a pair consisting of a number (1 through 13) and the name of the day. The 20 names of the days are:
imix |
ik |
akbal |
kan |
chicchan |
cimi |
manik |
lamat |
muluk |
ok |
chuen |
eb |
ben |
ix |
mem |
cib |
caban |
eznab |
canac |
ahau |
In each successive day both the number and the name of day changes, i.e., both cycles are incremented simulaneously. And since 13 and 20 are relatively prime, every day of the 260-day cycle had a unique name. The days of the Tzolkin calendar are known as:
1 imix, 2 ik, 3 akbal, 4 kan, 5 chicchan, 6 cimi, 7 manik, 8 lamat, 9 muluk, 10 ok, 11 chuen, 12 eb, 13 ben, 1 ix, 2 mem, 3 cib, 4 caban, 5 eznab, 6 canac, 7 ahau, 8 imix, 9 ik, 10 akbal, ... , 5 eb, 6 ben, 7 ix, 8 mem, 9 cib, 10 caban, 11 eznab, 12 canac, and 13 ahau.
In this project we will also need to count cycles in the Haab and Tzolkin calendar. (Actually, for longer spans of time the Mayan did not count cycles in the Haab and Tzolkin calendar, but counted the days since the creation of the world.) In our count of Haab and Tzolkin cycles, we will start both cycles at cycle 0. Thus, the very first day will be designated:
Haab | Tzolkin |
---|---|
0. pop 0 | 1 imix 0 |
Write a Java program Maya that takes a filename as a command-line argument. Each line in the file should be a Haab dates in the format
Number_Of_The_Day. Month Haab_Cycle_Numberwhere the Haab cycle number is greater than or equal to 0 but less than 5000. (Ignore white space in the input line.) Convert the date to the Tzolkin calendar and print the result in the following format:
Number Day_Name Tzolkin_Cycle_NumberNo error checking is required; do not reject input that has extra tokens at the end of the line.
For the sake of novelty, the output must be in reverse order of the input. You must use the class LinkedList.
There should be the same number of output lines as lines in the input file. Do not echo print the input; do not print blank lines.
Here are sample dates in both calendars.
Haab | Tzolkin |
---|---|
0. pop 0 | 1 imix 0 |
10. zac 0 | 3 chuen 0 |
10. zac 1995 | 9 cimi 2801 |
{"pop", "no", "zip", "zotz", "tzec", "zul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu", "uayet"}
{"imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"}
Use the following command on maelstrom.cs.fit.edu or zach.cs.fit.edu
~ryan/bin/mfiles ryan@cs.fit.edu "cse4510/lab06" Maya.java
Be sure your name is in comments somewhere at the beginning of each Java file you submit. Try to avoid putting tabs in your files as tabs are rarely interpreted the same by different applications. With luck a summary of the submissions for this lab exercise will be found in the file lab06-sub.txt.