Working with dates

advertisement
Working with dates
Part A:
Assignment: Write a class to handle Dates, the Date class should have a constructor that takes
in a month, day and year, and era. Write an event class that contains a date, a name of an
event, and a number of days to adjust the event by. Do not use any of the built in java classes to
handle your dates or events
Then construct a program that prompts the user for the information and adjusts the event and
date accordingly and outputs the result. An example is below.
Input:
What is the event? Contract start
What is the starting day? 18
What is the starting month? 1
What is the starting year? 2004
What is the starting era (A or B)? A
How many days to add? 30
Output:
30 days after the Contract start on January 18, 2004 A.D. is February 17, 2004 A.D.
Part B: Adjust your program such that you can input a year and the program will return whether
or not that year is a leap year. Do not use the internet to find code to do this.
year is not divisible by 4 = common year
year is not divisible by 100 = leap year
year is divisible by 400 = leap year
otherwise common year
Download