classes

Discussion in 'C++' started by poopsy, Feb 16, 2007.

  1. poopsy

    poopsy New Member

    Joined:
    Feb 16, 2007
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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
     
    Last edited by a moderator: Feb 16, 2007
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    This forum is not assignment solution providers forum but we can help you if you can let us know whats the problem area.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice