All pastes #209459 Raw Edit

Anonymous

public cpp v1 · immutable
#209459 ·published 2006-10-19 05:13 UTC
rendered paste body
// CIS 235 Revised  -  Homework 2 // Given the class definition for an event//  -- Write the member functions for the class event//  -- Write the 3 NONMEMBER functions: makeEvent, getSource, and advanceDate//  -- Write a main program to test all member functions for the class//          and the  3 nonmember functions: makeEvent, getSource and advanceDate//  -- Use three files  event.h     event.cpp      drhw2.cpp// You need not include any data error checking code#include <fstream>using std::ostream;#include <cstring>     // Needed for string functions//   The Designer decides upon the following data and actions (i.e. Functions)//       and places the class  in the file event.h  class event {	 public:			 event(void);                       // default constructor			 event(long, const char [],int d,					 int m, int y);             // 5 argument constructor			 event(const event &);              // copy constructor			 void keyBoardInput(void);          // Assume no blanks in the desc			 long getSource(void) const;        // return source			 void setSource(long);              // change source			 void setDate(int d, int m, int y); // set day, month, year			 void copyTo( event & ) const;      // copy invoking instance to parameter			 void incrementDate(void);          // advance the date by ONE day													  // You can assume 30 days in each month			 void print(ostream &, int dateFormat) const;   // print all fields						// dateFormat == 1   month/day/year						// dateFormat == 2   day/month/year			 ~event();                       // destructor - indicate the address										 	 //    of the variable that is leaving	 private:			 //  private functions - only the implementer can use these functions			 void setMonth(int);			 void setDay(int);			 void setYear(int);			 int  getMonth(void) const;			 int  getDay(void)   const;			 int  getYear(void)  const;			 // data			 long source;          //  id of the person scheduling the event			 char * desc;          //  description of the event			 int  day;             //  day, month, and year when the event			 int  month;           //      will happen			 int  year;	 };//   *********************************************************************//  **********************************************************************// The implementer will write all of the member functions//         and place these functions in a separate file "event.cpp"//   *********************************************************************// The Client, i.e. User, will create the file drhw2.cpp//  and prototype, write, and use the following 3 functionsevent makeEvent(long, const char [], int d, int m, int y);long getSource(const event &);   // will return the source in the parameter//  The following function will return an event with the same source and desc//     as the parameter event.  The day, month, and year will reflect numberOfDays//     into the future.event advanceDate( const event &, int numberOfDays);//  **********************************************************************//                      main driver programvoid main(){//  The client will test the 3 function above along with all//             of the member functions	return;}//  **********************************************************************//  Client places the code for makeEvent, getSource and advanceDate hereevent makeEvent(long s, const char n[], int d, int m, int y){}long getSource(const event & e)   // will return the source in the parameter{}event advanceDate( const event & e, int numberOfDays){}