class Date{
public:
Date(); // initialize attributes with default values
bool setDate(); /* assign values to Date attributes,
return true iff valid range of values are input */
void getDate(int& , int& , int&); // retrieve Date attribute values
void showDate(); // Display Date attribute values
// All other relevant methods go here
private:
bool validateDate(); // Validate attribute range values
int Day;
int Month;
int Year;
};
class DateCalculator{
public:
int daysBetween(Date& , Date& ); // return days elapsed between two Dates
bool isEarlier(Date& D1, Date& D2); /* return true if D1 is earlier
or same as D2 otherwise return false */
// All other relevant methods go here
private:
// All relevant attributes go here
};
using namespace std;
#include <iostream>
#include "Date.h"
#include "DateCalculator.h"
int main(){
Date d1, d2;
DateCalculator dc;
char quit = 'n';
while(quit != 'y'){
if(d1.setDate() && d2.setDate()){
if(dc.isEarlier(d1, d2)){
cout << "Days elapsed between ";
d1.showDate();
cout << "and ";
d2.showDate();
cout << "is " << dc.daysBetween(d1, d2) << endl;
} //end if
else {
cout << "ERROR: Invalid chronological dates" << endl;
continue;
} //end else
} // end if
cout << "Quit (y/n)? ";
cin >> quit;
} // end while
return(0);
} // end main
Write your class definitions in file asg1.h , your class method implementations in file asg1.C , and the main() function in file asg1_main.C . Copy your files into your subdirectory under the /accounts/classes/subraman/ba6806 subdirectory. The deadline for this project is 3/03/2005
Grades...