I NEED HELP WITH A BIRTHDAY PROFILE IN C++
I have to create three classes: Person,birthdate, and date. Create seperate .h and .cpp files to seperate the implementation from the interfaces.

2. Create a list of attributes and operations for all the classes.

3. Implement the methods,attributes, and constructor for these classes...

Recommended Answers

All 6 Replies

What part do you need help with?

I seem to keep saying this to everyone...but have you attempted the problem yourself yet? If so, where are you stuck? If not, I suggest you first give it a go, write down on paper some flowcharts...do some problem solving ;) Then post back here.

Regardless, I guess I could be a little more help for now...usually I just say google it, but here is a good starting place if you don't understand classes:

http://www.cplusplus.com/doc/tutorial/classes.html

Have you started programming this yet? I hope your not expecting someone to do this all for you.

1. Creating seperate files are easy, in dev C++, just make a new project, and then you can add as many files as needed to your program, wiether it be .h or .cpp. As for the three classes, classes are set up like this:

class myclass
{
         public:
              int myVar;
              void myMemberFunction();
}

2. You would probably do this on paper after your done coding it?

3. Not really sure what its inquiring to here.

Yes I started the first part of my program its:

#include <iostream>
#include<string>
using namespace std;

using std::cout;
using std::endl;
using std::cin;
void printbirthstone (int);
void printastro (int);
void season (int);


int main()
{

string name;
int bdayyear = 2000;
int bdaymonth = 1;
int day = 1;
int birthstone = 1;
int astro = 1;
int season = 1;
int menu = 0;

cout <<" * * * * *\n";
cout <<" * * * * * * * * * *\n";
cout <<" * * * * * * * * * *\n";
cout <<" * * * * * * * * * *\n";
cout <<" * * * * *\n";

cout <<"Menu for Birthday Project\n";
cout <<"1. Please enter theperson's name:\n";
cout <<"2. Enter persons bithday year:\n";
cout <<"3. Enter persons birthday month:\n";
cout <<"4. Enter birthday day:\n";
cout <<"5. Display you birthstone:\n";
cout <<"6. Display your Astrological sign:\n";
cout <<"7. Display the season in which your birhday occurrs:\n";

cout <<" * * * * *\n";
cout <<" * * * * * * * * * *\n";
cout <<" * * * * * * * * * *\n";
cout <<" * * * * * * * * * *\n";
cout <<" * * * * *\n";

cout <<" Enter menu selection 1 through 7\n";
cin >>menu;

switch(menu)
{
case 1:
cin>>name;
break;

case 2:
cin>>bdayyear;
break;
case 3:
cin>>bdaymonth;
break;
case 4:
cin>>day;
break;
case 5:

break;
case 6:

break;
case 7:

break;






system("pause");
return 0;
}
void printbirthstone (int x)
{
switch (x)
{
case 1:
cout<<"Granet ";
break;
case 2:
cout<<"Amethyst ";
break;
case 3:
cout<<"Aquamarine ";
break;
case 4:
cout<<"Diamond ";
break;
case 5:
cout<<"Emerald ";
break;
case 6:
cout<<"Pearl ";
break;
case 7:
cout<<"Ruby ";
break;
case 8: 
cout<<"Peridot ";
break;
case 9:
cout<<"Sapphire ";
break;
case 10:
cout<<"Opal ";
break;
case 11:
cout<<"Topaz ";
break;
case 12:
cout<<"Turquoise ";
break;
default:
cout<<" Please enter a zodiac sign 1 to 12\n"

}
void printastro (int y)
{



}
void season (int z)
{




}

Seems good so far to me. What do you need help with though? From what i can see you know how to do most of the stuff yourself.

Thank you but I'm a liit confuse on how to create the classes for part 2 for person,birthdate, and date well the other things thats above and incoprate them in this program I guess I'm a person that needs to be sure.

Do you know how to create a class? Lets start with the easiest one -- date

class date
{


};

Next you want to add a few data objects, such as day, month and year

class date
{
private:
    int day;
    int month;
    int year;


};

Next, add the methods that will make the class do something. First create a constructor, which is a method that will initialize the class objects to 0

class date
{
private:
    int day;
    int month;
    int year;
public:
    // class constructor
    date();

};

Then add more methods as needed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.