Lately i have been working on a program which lets employees clock in and clock out in the work place.I want 10 employees to be able to clock in when they arrive to work and clock out when they finish .I have attempted it but cant get my head around the loops and arrays.Each employee is paid $25 per hour but must be paid for excess minutes also.the time they work must be calculated by subtracting the clock in time from the clock out time..when the program is run the employee is greeted by a menu whuch allows them to Clock in , Clock out or Exit.
I would like to be able to enter the times manually
When exit is chosen by the employee a report is generated and displayed.The report will list the name of the ten employee with their pay for the day and the total amount of money earned by employees. If an employee did not clock in the word absent should appear alongside their name.
Any help or advice would be great as im quite new to C++ and trying to learn and advance in it ...
cout<<"good morning please enter your clock in time"<<endl;
cin>>in
else if
(choice==2)
cout<<"Please enter your clock out time"<<endl;
cin>>out
else if
(choice==3)
cout<<"press and key to terminate the program"<<endl;
cin>>print
else
cout<<"that is an invalid key"<<endl;
To start the display menu function should have some sort of header.
1 2 3 4 5 6 7 8 9 10 11 12 13
void countpay () {
//Counts the employees individual pay
unsignedshort rate=25;
unsignedshort hours=0;
for(unsignedshort i = 0; i<=noEmployees-1; i++)
do {
(out-in)*25=pay
cout<<"your pay for the day is $"<<pay<<endl;
}
This code needs a variable like maxHours to determine when to pay overtime. If your not paying overtime but would still like to show how much more they earned than a regular days pay you would still need a value to represent a "regular" work day.
if you know how to work with structures this would be a good place to use one.
example:
1 2 3 4 5
struct employee
{
empName[amtEmployees];
empHours[amtEmployees,2];//second dimension to hold total pay
};
if your not familiar with structs you could just define two array's and use one index variable to move through them.
I would suggest using a switch statement for you clock in clock out menu and then calling the appropriate functions.
Unless you plan on writting your own time function i would #include <ctime>