Ejemplo n.º 1
0
int main()
{
	int Num;

	cout << "Enter an integer representing a day of the year and\n"
		 << "this program will print it in month-day format: ";
	cin  >> Num;

	DayOfYear Day = Num;

	Day.print();
}
Ejemplo n.º 2
0
//Execution Begins Here
int main(int argc, char** argv) {

    //Declare and initialize the variables
    int month;
    DayOfYear con;
    
    cout<<"Please enter the integer number you would like to have converted to month and day."<<endl;
    cout<<"Day ";
    cin>>month;
    
    con.print(month);
    
    //Exit stage right
    return 0;
}
void Employee::output() const
{
    DayOfYear bday;
    bday = get_birthday();
    
    cout << "------------------------------\n";
    cout << "id=" << get_id() <<endl;
    cout   << "name=" << get_name() << endl;
    cout << "birthday=" << bday.get_day();
    cout << "-" << bday.get_month();
    cout << "-" << bday.get_year() << endl;
    cout << "#emails=" <<get_num_emails()<<endl;
    cout << " 1st email=" <<getEmail(0)<<endl;
    cout << "base salary="<<getBaseSal()<<endl;
    cout << "current salary="<<getCurrentSal() <<endl;
    cout << "rate=" <<retrieveInterest() <<endl;
    cout << "year=" <<getDuration()<<endl;
    cout << "------------------------------\n";
    
}
//Taken from Yang's student.cpp
ostream& operator<<(ostream& out, const Employee& std)
{
    DayOfYear bday;
    bday = std.get_birthday();
    
    out << "------------------------------\n";
    out << "id=" << std.get_id() <<endl;
    out   << "name=" << std.get_name() << endl;
    out << "birthday=" << bday.get_day();
    out << "-" << bday.get_month();
    out << "-" << bday.get_year() << endl;
    out << "#emails=" <<std.get_num_emails()<<endl;
    out << " 1st email=" << std.getEmail(0)<<endl;
    out << "base salary="<<std.getBaseSal()<<endl;
    out << "current salary="<< std.getCurrentSal() <<endl;
    out << "rate=" << std.retrieveInterest() <<endl;
    out << "year=" << std.getDuration()<<endl;
    out << "------------------------------\n";
    
    return out;
}
Ejemplo n.º 5
0
int main( int argc, const char* argv[] ){
	//declare variables
	int day=NULL;
	DayOfYear a;
	char again='n';
	do{
		do{
			//prompt for input
			cout<<"Please enter a day of the year. (1-365)\n";
			cin>>day;
		}while(day > 365 || day < 1);
		//pass into class
		a.setNum(day);
		//print results
		a.print();
		//repeat?
		cout<<"Again? (Y/N): ";
		cin>>again;
	}while(again == 'y' || again == 'Y');
	return 0;
}
Ejemplo n.º 6
0
int main(int argc, char** argv) {
//declare variables
    int day;
    char leapQ; //leap year question
    DayOfYear info;
    //input day
    do{
        cout<<"Is it a leap year this year? Type y if yes, n if no "<<endl;
        cin>>leapQ;
        leapQ=tolower(leapQ);
        if(leapQ!='y'&&leapQ!='n')
            cout<<"Invalid answer"<<endl;
    }while(leapQ!='y'&&leapQ!='n');
    do{
        cout<<"Enter a day of the year (out of 365)"<<endl;
        cin>>day;
    }while(day>366&&day<1);
    if(leapQ=='y')
        info.leapYear(day);
    else
        info.print(day);
    return 0;
}
Ejemplo n.º 7
0
bool equal(DayOfYear date1, DayOfYear date2)
{
     return ( date1.get_month( ) == date2.get_month( ) &&
                date1.get_day( ) == date2.get_day( ) );
}
Ejemplo n.º 8
0
void incrementMonth(DayOfYear& dy)
{
    int m = dy.getMonth();
    m++;
    dy.setMonth(m);
}