![]() |
Assignment 07TaskUse conditionals to sort through the morass of Bleegian mining events and regulations.
Textbook: 5.1 - 5.2 ScenarioThe planet Bleeg is known for both its bloated governmental bureaucracy and its bloodthirsty space pirates. Through various sordid misadventures, you have been captured by such space pirates and sold into slavery. You now toil in the fetid plutoxium mines of Korvath--one of the moons of Bleeg. The Korvathian mine overseers have a bit of a problem. Like most Bleegians, they have very strict rules about what activities they allow each other to engage in on different days. Also, due to the nature of Korvath's orbit around Bleeg, certain events--such as venting steam geysers and freezing eclipses--occur on a regular basis. Although all these events are quite predictable, your Korvathian overseers spend most of their time drunk on grog (and were probably not shining examples of Bleegian intelligence to begin with). Therefore, they've long sought a way to offload some of this unnecessary cogitation. When one of the overseers learns that you can program (just a little), the task falls to you to write a program to track all of these things. If you do well, this could be good from you--you would be allowed to work in the upper office levels of the mine, free from the radioactive plutoxium dust of the dank mining shafts below and closer to potential escape opportunities. On the other hand, should you fail, things could be get very ugly... Good luck! What you need to knowYou are given the following information, most of which is necessary to complete your program. Bleegian calendar. The miners of the Korvath moon follow the traditional Bleegian calendar. The Bleegian year of 364 days is divided into 13 months of exactly 28 days each. Bleegians start counting days of the month at 0, however. So each month would include: 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 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.) To further complicate matters, some Bleegian's prefer to number days from the end of the month, rather than the beginning. To prevent total confusion, dates in this "count-down" calendar are given as negative numbers. Therefore, Day -1 == Day 27, Day -2 == Day 26, Day -3 == Day 25, and so on. Luckily, both the standard and the count-down calendars coincide on Day 0. All official regulations and events are specified using the dates of the standard calendar.
Work: All slaves must labor every day except for Festival. Tremors: Korvath orbits Bleeg once very four days. On even days (so Day 0, 2, 4, ...), the moon, the planet, and the sun align with each other. This exerts exceptional gravitational forces on Korvath, which heats the moon's core. This leads to tremors--which can cause mine cave-ins and other equipment damage. Also, on hot days, it can cause super-heated steam geysers to vent in the lower shafts, usually scalding many of the slaves. Eclipse: Every fourth day (so Day 0, 4, 8, 12, ...), Korvath passes through the shadow of Bleeg. During this eclipse, the moon's temperature drops sharply, potentially leading to hypothermia amongst the poorly-garbed slaves. Collection: Since cold keeps the toxic dust down, the mine overseers always collect the accumulated plutoxium slag on the day after the eclipse (so Day 1, 5, 9, 13, ...). Grog: While overseers drink nearly constantly, they have decided to distribute a diluted grog mixture to slaves every Wednesday in order to improve morale (and thus production rates). Also, in honor of Festival, slaves get grog then too. Flogging: Since slaves tend to mine a little slower on the cold eclipse days, the overseers have decided to flog everyone on those days. This activity keeps everyone warm and motivated. However, there is an old saying on Korvath: "Flogging and grogging don't mix!" Therefore, flogging is not practiced on any day where there is also grog served to slaves. The program requirementsSo that's all the background information you need. Here's what the overseers say the program must actually do:
Sample OutputD:\TA\grading\A07>java ZtomaszeA07 Please enter the current Bleegian day of the month: 30 Sorry, but 30 is not a valid day of the month. D:\TA\grading\A07>java ZtomaszeA07 Please enter the current Bleegian day of the month: 0 Today (Day 0) is Festival. Today will be marked by: tremors eclipse grog D:\TA\grading\A07>java ZtomaszeA07 Please enter the current Bleegian day of the month: -9 Today (Day 19) is Friday. Today will be marked by: work D:\TA\grading\A07>java ZtomaszeA07 Please enter the current Bleegian day of the month: 17 Today (Day 17) is Wednesday. Today will be marked by: work collection grog What to Submit
Submit your Grading [6 points]
FAQs
|
~ztomasze Index :
TA Details: ICS111:
A07 http://www2.hawaii.edu/~ztomasze |
Last Edited: 15 Sep 2009 ©2009 by Z. Tomaszewski. |