Department of Computer Science.

Georgia State University

CSc 2311                                                                                                          J. L. Bhola

Spring 2008 – Assign#4

Due March 20th, 2008

Note:  (1) For all assignments, always use comments to explain your program.

          (2) No copying allowed. If it is found that students copy from each other, all of these programs will get 0.

(3)   You must use the name given to name your program. Should you use a different name, you would lose 10% of what the program is worth.

 

Description of program:

You are to write a program name cal_date.cpp that can manipulate a Date object. The program must be menu driven. The Date object must be constructed with a default date that is 1/1/2000. You may if you wish write a separate file for the Date class and then write a driver program or write everything in one file. Note the year 2000 is a leap year but 1900 is not a leap year: Years that are multiple of 4 are leap years. Also, years that are multiple of 100 and multiple of 400 are leap years.

 

Here are some requirements for the program:

 

The program must display a menu consisting of the following:

(a)  Add a user’s input number of days to the default date and display the new date and old (default) date. Say if the new Date is a leap year.

(b)  Subtract a user’s input number of days from the default date and display the new date and old (default) date. Say if the new Date is a leap year.

(c)  Add user’s input number of months to the default date and display the new date and old (default) date. Say if the new Date is a leap year.

(d)  Subtract a user’s input number of months from the default date and display the new date and old (default) date. Say if the new Date is a leap year.

(e)  Add a user’s input number of years to the default date and display the new date and old (default) date. Say if the new Date is a leap year.

(f)   Subtract a user’s input number of years from the default date and display the new date and old (default) date. Say if the new Date is a leap year.

(g)  Compare two user’s input dates and display these dates with an appropriate message if date1 == Date2, Date1 < Date2 or Date1 > Date2.

(h)  Quit.

What to turn in:

1.     A 3.5 inches floppy disk (IBM compatible) consisting of the .cpp and the  .exe files. MAKE SURE THAT YOUR DISK IS VIRUS CLEAN. 
2.    
A print out of each of the  .cpp file (source code) and .h (header file) if you used separate files.
3.     Make sure that your name is written clearly both on the print out and the disk.
4.    
Make sure that both the .cpp and .exe files are on the root directory i.e. on the a:\  drive.         
       Example:   
                                    a:\
cal_date.cpp
                                    a:\ cal_date.exe

And if you use separate files for the Date object, then

                                      a:\Date.cpp
                                      a:\Date.h

 

Should you use any subdirectory (whatsoever) your program would not be graded and you will receive a 0 (zero).