## Assignment 07

Use conditionals to simulate the core precepts of Bleegian numerology.

Textbook: 5.1 - 5.2
Concepts: conditionals; logical operators; [`switch`].

### Scenario

You have been captured by Bleegian space pirates.

Aside from its pirates, the planet Bleeg is also known for its bloated governmental bureaucracy, its cruel slavery trade, and the superstitiousness of its general population.

What is less well-known is that many sectors of Bleegian society--including even the feared space pirates--seek the prophetic advice of the Witch-Seers of Babelae before undertaking any significant new endeavor. Using the day of the year as a starting point, these Witch-Seers are able to accurately forecast whether that day will bring good fortune or ill. However, the services of the Witch-Seers of Babelae do not come cheap.

Recently, a rogue space-pirate vessel raided a remote Witch-Seer stronghold and managed to procure one of the sacred Tomes of Prophetic Numerology. When taken as a whole, the system it documents is quite complex. However, pirate scholars have determined that three numbers--4, 7, and 13--seem to serve as the core of the system. Using rules based on only these numbers, their initial tests have suggested that they can duplicate the predictions of the Witch-Seers with an 80% accuracy rate.

The space pirates would now like to distribute these rules to their entire fleet. Then they could still raid with confidence in their fortunes without having to pay the high fees of the Witch-Seers. However, to protect the rules from being stolen by others, as well as to limit misinterpretation by drunk or ignorant pirate captains, they have decided to find someone to encode the rules as a simple program.

When it is discovered that you--a lowly slave--can program, you are hauled up from the dark and fetid slavehold and set to work.

Good luck! If you're lucky and do a good job, you just might live long enough to plan an escape...

### What you need to know

You are given the following information, most of which is necessary to complete your program.

Bleegian calendar. The Bleegian year of 364 days is divided into 13 months of exactly 28 days each. Bleegians start counting at 0, however. Therefore, the months are numbered: 0, 1, 2, ... 11, 12. Similarly, each month includes: Day 0, Day 1, Day 2, ... Day 26, Day 27.

Like us, Bleegians have a 7-day week. The days are, oddly, named the same as ours: Sunday, Monday, Tuesday, etc. Both the week and the month starts with Sunday. Because every month is exactly 4 weeks long, every Day 0 is always a Sunday, every Day 1 is a Monday, and so on.

While Day 0 of each month is technically a Sunday by these rules, it is a special holiday for all Bleegians. Therefore, it is always called Festival. (Day 7, Day 14, and Day 21 are all normal Sundays.)

The stolen numerological system makes predictions based on the day of the year--specifically, whether it is evenly divisible by certain numbers.

Lucky: Any day divisible by 7 is lucky (except see below: Unlucky, Indeterminate, Blessed, Momentous).

Unlucky: Any day divisible by 4 is unlucky. However, if it is also divisible by 7, then it is neither lucky nor unlucky [and so neither word should be printed that day]. Again, there are exceptions (see Indeterminate, Cursed, Momentous).

Indeterminate: Normally, a day divisible by 13 means the cosmos is in flux. A person moving forward with a strong will and clear mind can make their own luck that day. Therefore, their fate can not be determined before that day.

Blessed: A day divisible by both 7 and 13 is neither lucky nor indeterminate, but blessed instead.

Cursed: A day divisible by both 4 and 13 is neither unlucky nor indeterminate, but cursed instead.

Momentous: A day that is divisible by all three numbers--4, 7, and 13--occurs only once a year. It has none of the above labels. Instead, it is a time for change and new beginnings. It is momentous.

Neutral: If a day is none of the above, it is simply neutral.

Thus, every day should receive one, and only one, label.

#### The program requirements

So that's all the background information you need. Here's what the pirates say the program must actually do:

• The program should ask the user to enter the current day of the month. (Thus, any integer between 0 and 27 is valid. If the user enters an invalid number or String, give an error message and no further output.)
• Then the program should ask for the current month as an integer. (Thus, any value between 0 and 12 is valid. Again, give an error message and stop if the input is invalid.)
• Print the inputted date in the form of "Day # of Month #"
• Print what day of the year that is.
• Print the day of the week. (Remember, within a month, Day 0 is Festival, Day 1 is Monday, Day 2 is Tuesday, and so on.)
• Give the prophetic adjective/label describes that day. Allowed terms include: lucky, unlucky, indeterminate, blessed, cursed, momentous, and neutral. If a term does not apply on the given day, then that term should not appear anywhere in your output.

### Sample Output

```D:\TA\grading\A07>java ZtomaszeA07
For your fortune, enter a Bleegian day of the month: 0
Enter a Bleegian month: 0
Day 0 of Month 0 = Day 0 of the year.
It is a Festival.
The day will be: momentous.

For your fortune, enter a Bleegian day of the month: 12
Enter a Bleegian month: 3
Day 12 of Month 3 = Day 96 of the year.
It is a Friday.
The day will be: unlucky.

For your fortune, enter a Bleegian day of the month: 30
Sorry, but 30 is not a valid day of the month.

For your fortune, enter a Bleegian day of the month: 7
Enter a Bleegian month: 3
Day 7 of Month 3 = Day 91 of the year.
It is a Sunday.
The day will be: blessed.

For your fortune, enter a Bleegian day of the month: 0
Enter a Bleegian month: 12
Day 0 of Month 12 = Day 336 of the year.
It is a Festival.
The day will be: neutral.

For your fortune, enter a Bleegian day of the month: 15
Enter a Bleegian month: feb
Sorry, you must enter a number.
```

### What to Submit

Submit your `UsernameA07.java` file to Tamarin.

1 - Compiles
Your program compiles successfully (no errors)
0.5 - Input
You read in the Bleegian day of the week and the month (both `int`s) from the user.
1 - Error-checking
You report if the entered day or month is a String or out of range (and, if so, print no other output).
0.25 - Date
You print the inputted date in the form of "Day # of Month #"
1 - Conversion
You print the correct day of the year.
0.75 - Day of the week
You print the correct day of the week.
2.5 - Label
You correctly print the prophetic adjective (and only that adjective) for that day.

### FAQs

From there, the code is largely a test of divisibility of the input. For example, you can you use `% 7` to determine which day of the week it is from the day of the month. A switch could be handy here. (Remember that some Sundays are Festival though, so there will an extra test needed within that 0 case.)