Monday, December 12, 2011

Problem Statement:Write a c++ program which consists of two classes:First class Date should contain three data?

Problem Statement:


Write a c++ program which consists of two classes:


1. Date


2. Student


First class Date should contain three data members:


Day


Month


Year


Date also contain following member functions:


Setter function


Getter function


showdate()





Now second class Student should have following three data members:


ST_ID


Name


Ad_date


Where ID and Name are char pointer while Ad_date (Date of Admission) is of type Date.





Student class should contain two member functions:


Display()


setdate()


Now in main function create an object of Class Student and call the member functions with it.


--------------------------------------鈥?br>

Sample output:





Name: Ali


ID: BC020400000


Admission Date: 12-08-2008|||This will give you the basics to get started. Try to add to it to complete the program. Email if you need help.








class Date


{


int Day, Month, Year;


public


SetDate(Date *pOther);


};





class Student


{


char * ST_ID,


*Name;


Date Ad_Date;


public:


Student(char *id, char*name, Date *pAdmitDate;


};





Date::SetDate(Date *pOther)


{


Day = pOther-%26gt;Day;


Month = pOther-%26gt;Month;


Year = pOther-%26gt;Year;


{


}





Student:Student(char *id, char*name, Date *pAdmitDate)


{


ST_ID = id;


Name = name;


Ad_date.SetDate(pAdmitDate);


}|||Man this is easy, and I've never been to school for this stuff :)

No comments:

Post a Comment