Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   classes (http://www.go4expert.com/forums/classes-t3035/)

poopsy 16Feb2007 17:21

classes
 
Hi evry1..im kinda new here..wud b grateful if u cud help me wiv the following question..am having problems dealing wiv classes questions though i think i understood it..
i've tried to do it a bit.. here is the question


The class Date has the following data members:
 Month
 Day
 Year
and member functions:
 A default constructor that initialises all data members to zero.
 A constructor to create and initialise a Date object with the values passed as parameters
 Assigndate to assign values to the data members from the keyboard in the format:
Day: 9
Month: 10
Year: 2002
 Displayshort to display a date in short form e.g. “09/10/2002”
 DisplayVerbose to display a date in form “October 9, 2002”
 NextDay to change the date to next day e.g. “October 10, 2002”

(a) Write the class interface for the class Date.

(b) Write the full function implementation for the member functions of the class Date.

(c) Write a main program that declares two objects D1 and D2 of type Date. D1 must be initialised to the value “23 October 2002” and D2 must get its value from the keyboard. The program must then find the earlier of D1 and D2 and display the same in both formats. The program must also set the date D2 to next day and display the same in both formats.





ive started by doin the 3rd part c directly..ive got only that until now:

Code:

#include<iostream.h>
#include<conio.h>

  class Date{
    char month[10];
    int month;
    int day;
    int year;

  public:
    Date();
    Date(char, int, int);
    void Assigndate();
    void Displayshort();
    void DisplayVerbose();
    void NextDay();
    }

void main(){
Date D1,D2;

cout<<"Enter the date"<<endl;
cin>>date;

plzzz help

shabbir 16Feb2007 22:28

Re: classes
 
This forum is not assignment solution providers forum but we can help you if you can let us know whats the problem area.


All times are GMT +5.5. The time now is 19:30.