|
|
Parkland College
2400 West Bradley Avenue, Champaign, Illinois 61821 |
|
| Csc 123 - Computer Science I, Programming in Java |
| Project 2 |
| Wednesday, October 18, 2006 (changed again!) |
Create a Java program that accepts a
standard date from the user in three inputs (month, day, year), and then
displays the following
information.
1. Whether that year is a leap year.
2. The day of the week (Monday, Tuesday, ...)
3. The ordinal date for that year (sometime called the Julian Date) - for an
explanation see
http://en.wikipedia.org/wiki/ISO_8601#Ordinal_dates
4. The week date for that year - for an explanation see
http://en.wikipedia.org/wiki/ISO_8601#Week_dates
5. Whether or not a
woman is allowed to propose marriage to a man, and what the man must do if he
refuses - see
http://en.wikipedia.org/wiki/Leap_year#Marriage_proposal. You
may use the less restrictive rule or the more restrictive rule, depending on
what you think about this tradition.
For an example of a professional version of most of the program go to http://www.personal.ecu.edu/mccartyr/isowdcal.html. Your version may only show the required information as text, without the colors and layouts.
For the rules to determine a leap year see http://en.wikipedia.org/wiki/Leap_year#Rules_for_determining_when_to_have_a_leap_year
For an algorithm to calculate the day of the week see Zeller's formula for calculating the day of the week. This formula is taken from http://mathforum.org/dr.math/faq/faq.calendar.html
For algorithms to calculate the ordinal date and week date use the explanation links above to devise your own algorithm.
Your program must be a Java Application. You may base it on any code given to you by the instructor.
Important: Your program must
have at least five private functions, one to calculate each of the results
listed above. Call those functions from within the ActionListener for the
Button. You are encouraged to use Instance Variables for any data that
must be used by more than one of these private functions.
You may simply display all the information in the TextArea when the user presses
the button. The information must be easily readable with proper labels or
sentences to identify each piece of data. You may have a more complicated
display if you wish, but you are not required to do anything more than a simple
text display.
Your program must be accurate from years 1583 to 2101 according to the standard
Gregorian Calendar (http://en.wikipedia.org/wiki/Gregorian_calendar).
Be careful of the years 1600 and 2000! If the date is before 1752,
you may assume that you are in a Catholic country.
Your program must have three inputs (month, number date of the month, and
year) and a button that tells your program to display the information. To
simplify your program, you may remove the Listeners from the three inputs, if
you want, and only keep an ActionListener on the Button.
You may use
TextFields for the month and number date of the month, if you want, but a List
may simplify your program logic by preventing incorrect input.
You must use a TextField for the year
input, since the calculator must be accurate for the years 1583 to 2101.
Since
we will not spend any significant time on the LayoutManager classes, the layout of your
program can be the simple flow layout included in the code supplied by the
instructor. You can use a more complex layout if you
want to investigate layouts more.
Your program must be written in standard Java, in good Java style as discussed in class, and must compile and run using JCreator or the javac and java command line programs.
Grading
Project 1 is worth ?? points toward the final grade. It will be graded according to the criteria on the Project 2 Grade Report. Your grade will be recorded on Angel.
Date
Your project will be interactively graded on Wednesday, October 18th. On Monday, October 16th each student will sign up for a specific 15 minute period for grading on the following Wednesday. You may have your project graded before October 18th, if you wish, by making arrangements with the instructor.
| Back to Csc 123 - Computer Science I, Programming in Java |
| Scott Badman Office: B132 Phone: 353-2250 sbadman@parkland.edu |
Parkland College, 2400 W. Bradley Avenue, Champaign, IL 61821 |