{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

recitation2 - 15-100 RECITATION 2 FALL 2007 In the...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
15-100 RECITATION 2 - FALL 2007 In the Gregorian calendar (the one we use today), an amazing property exists. On any given year, the dates 4/4, 6/6, 8/8, 10/10 and 12/12 all occur on the same day of the week. Also, so do 5/9 and 9/5 as well as 7/11 and 11/7. In addition, so does the last day of February. These days are known as "doomsdays". Exercise Using Eclipse, write a simple Java program in a project named Recitation2 that contains a class named DoomsdayComputer with a main method that prints out the day of the week on which the doomsdays occur for a given input year between 2000- 2099. First, use the Scanner class to read in a year entered at the keyboard (e.g. 2007). Be sure to print out an appropriate prompt before you read the input so the user knows what to enter. Read this year in as an int , not a String . Then, to compute the day of the week for the input year, follow these steps in your program: 1. Let y be the last two digits of the year. (HINT: Taking a number modulo 100 gives you the value of the last two digits. Do you see why?) 2.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}