I'm having problems with an assignment in C++. The assignment is this:
Make a program that reads two moment of times, given in hours and minutes. Theses moment of times are the start and end for a day of work. After that the hour's pay must be read in. The program are going to estimate the workday in hours and minutes, and estimate the gross wage for a day.
The screen-printout are going to tell how long it has been worked in hours and minutes, and the gross wage.
My code is this:
int Hour1, Hour2, Minute1, Minute2;
cout << "Key the hour when you start at work: ";
cin >> Hour1;
cout << "Key the minute in that hour you start at work: ";
cin >> Minute1;
cout << "Key the hour when you leave work: ";
cin >> Hour2;
cout << "Key the minute in that hour you leave work: ";
cin >> Minute2;
cout << "Key the hour's pay: ";
cin >> Hour_Pay;
cout << endl;
int Hours = Hour2-Hour1;
int Minutes = Minute1-Minute2;
double Total = (Hours)+(Minutes/60);
double Gross = Total*Hour_Pay;
cout << "You work " << Hours << " hours and " << Minutes << " minutes every day at work."
<< "Your gross day's pay is " << Gross << " dollars.";
This code is probably not any good at all, i guess i have to do some "variable%variable" but i don't know how or where.
Anyone that does have a suggestion on how to do this assignment?