Docsity

CSE 1301 Lab Project #3: Calculate Days Between Two Dates - Prof. Patricia H. Pierce, Lab Reports of Computer Science

Toggle sidebar
bg1
**************************************************
CSE 1301 Lab Project#3
Due: Monday, July 6, 2009
Write a program to accept any two dates in the form of month, day,
and year (8 23 2000), separated by spaces, and calculate the total
number of days that has elapsed between the two dates, inclusive of
the beginning and ending days. Remember that leap year is a year
divisible by 4, except for centennial years, which must be divisible by
400, such as 1600 or 2000 (1800 is not a leap year). You can test
your program with any typed in dates but it must finally run with the
data shown below. System output on the screen is acceptable.
DATA: ANSWERS
7 4 1776 1 1 1987 (76882)
2 1 1983 3 15 1984 (409)
7 7 1983 11 4 1983 (121)
7 3 1983 7 20 1983 (18)
12 25 1990 12 31 1992 (738)
your birthdate to due date (?)
Consider using the long data type for dayctr
Choose your own end of data technique.
Use if statements, switch statements, and loops to solve this
problem. Do not use the Gregorian date method!
Turn in assignment sheet, an algorithm for the main method,
source, and output
Extra Credit: Set up the date as an object-oriented data type
Create a Date class with month, day and year (all integers) as
instance variables.
You will need the following instance methods: default constructor,
parameterized constructor, toString, and a subtract method.
Also turn in a UML of the completed program along with the algorithm
of main.

Partial preview of the text

Download CSE 1301 Lab Project #3: Calculate Days Between Two Dates - Prof. Patricia H. Pierce and more Lab Reports Computer Science in PDF only on Docsity!

CSE 1301 Lab Project# Due: Monday, July 6, 2009 Write a program to accept any two dates in the form of month, day, and year (8 23 2000), separated by spaces, and calculate the total number of days that has elapsed between the two dates, inclusive of the beginning and ending days. Remember that leap year is a year divisible by 4, except for centennial years, which must be divisible by 400, such as 1600 or 2000 (1800 is not a leap year). You can test your program with any typed in dates but it must finally run with the data shown below. System output on the screen is acceptable. DATA: ANSWERS 7 4 1776 1 1 1987 (76882) 2 1 1983 3 15 1984 (409) 7 7 1983 11 4 1983 (121) 7 3 1983 7 20 1983 (18) 12 25 1990 12 31 1992 (738) your birthdate to due date (?) Consider using the long data type for dayctr Choose your own end of data technique. Use if statements, switch statements, and loops to solve this problem. Do not use the Gregorian date method! Turn in assignment sheet, an algorithm for the main method, source, and output Extra Credit: Set up the date as an object-oriented data type Create a Date class with month, day and year (all integers) as instance variables. You will need the following instance methods: default constructor, parameterized constructor, toString, and a subtract method. Also turn in a UML of the completed program along with the algorithm of main.