rendered paste body#include <iostream>
#include "BirthDate.h"
using namespace std;
BirthDate::BirthDate( int birth, int day2, int year ) : Date( birth, day2, year )
{
setGem( static_cast<Months>(birth) );
setSign( static_cast<Months>(birth), day2 );
setSeason( static_cast<Months>(birth), day2 );
}
void BirthDate::setSign(int signMonth, int signDay)
{
string zodiac[12] = { "Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo", "Libra", "Scorpio", "Sagittarius", "Capricorn", "Aquarius", "Pisces" };
int count = 0;
if ( ( signMonth == 3 && signDay > 20 ) || ( signMonth == 4 && signDay < 20 ) )
count = 0;
if ( ( signMonth == 4 && signDay > 21 ) || ( signMonth == 5 && signDay < 21 ) )
count = 1;
if ( ( signMonth == 5 && signDay > 20 ) || ( signMonth == 6 && signDay < 21 ) )
count = 2;
if ( ( signMonth == 6 && signDay > 20 ) || ( signMonth == 7 && signDay < 23 ) )
count = 3;
if ( ( signMonth == 7 && signDay > 22 ) || ( signMonth == 8 && signDay < 23 ) )
count = 4;
if ( ( signMonth == 8 && signDay > 22 ) || ( signMonth == 9 && signDay < 23 ) )
count = 5;
if ( ( signMonth == 9 && signDay > 22 ) || ( signMonth == 10 && signDay < 23 ) )
count = 6;
if ( ( signMonth == 10 && signDay > 22 ) || ( signMonth == 11 && signDay < 22 ) )
count = 7;
if ( ( signMonth == 11 && signDay > 21 ) || ( signMonth == 12 && signDay < 22 ) )
count = 8;
if ( ( signMonth == 12 && signDay > 21 ) || ( signMonth == 1 && signDay < 20 ) )
count = 9;
if ( ( signMonth == 1 && signDay > 19 ) || ( signMonth == 2 && signDay < 19 ) )
count = 10;
if ( ( signMonth == 2 && signDay > 18 ) || ( signMonth == 3 && signDay < 21 ) )
count = 11;
zodiacSign = zodiac[count];
}
string BirthDate::getSign()
{
return zodiacSign;
}
void BirthDate::setGem( int gemMonth )
{
switch ( gemMonth )
{
case 1:
gemName = "Garnet";
break;
case 2:
gemName = "Amethyst";
break;
case 3:
gemName = "Aquamarine";
break;
case 4:
gemName = "Diamond";
break;
case 5:
gemName = "Emerald";
break;
case 6:
gemName = "Pearl";
break;
case 7:
gemName = "Ruby";
break;
case 8:
gemName = "Peridot";
break;
case 9:
gemName = "Sapphire";
break;
case 10:
gemName = "Opal";
break;
case 11:
gemName = "Topaz";
break;
case 12:
gemName = "Turquoise";
break;
default:
gemName = "Invalid";
}
}
string BirthDate::getGem()
{
return gemName;
}
void BirthDate::setSeason( int seasonMonth, int seasonDay )
{
if ( seasonMonth >= 3 && seasonMonth <= 6 ) {
if ( seasonDay >= 21 && ( seasonMonth >= 3 && seasonMonth < 6 ) )
seasonName = "Spring";
if ( seasonDay < 21 && seasonMonth <= 6 )
seasonName = "Spring";
if ( seasonDay < 21 && seasonMonth == 3 )
seasonName = "Winter";
if ( seasonDay > 21 && seasonMonth == 6 )
seasonName = "Summer";
}
if ( seasonMonth >=1 && seasonMonth <=3 ) {
if ( seasonDay < 21 && seasonMonth <= 3 )
seasonName = "Winter";
if ( seasonDay >= 21 && seasonMonth < 3 )
seasonName = "Winter";
}
if ( seasonMonth >= 6 && seasonMonth <= 9 ) {
if ( seasonDay >= 21 && ( seasonMonth >= 6 && seasonMonth < 9 ) )
seasonName = "Summer";
if ( seasonDay < 21 && seasonMonth <= 9 )
seasonName = "Summer";
if ( seasonDay < 21 && seasonMonth == 6 )
seasonName = "Spring";
if ( seasonDay >= 21 && seasonMonth == 9 )
seasonName = "Fall";
}
if ( seasonMonth >= 9 && seasonMonth <= 12 ) {
if ( seasonDay >=21 && ( seasonMonth >= 9 && seasonMonth < 12 ) )
seasonName = "Fall";
if ( seasonDay < 21 && seasonMonth <= 12 )
seasonName = "Fall";
if ( seasonDay < 21 && seasonMonth == 9 )
seasonName = "Summer";
if ( seasonDay >=21 && seasonMonth == 12 )
seasonName = "Winter";
}
}
string BirthDate::getSeason()
{
return seasonName;
}