Help me

who can fix my program auto compute all total work hours and total work overtime

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
//Library :D
#include<iostream>
#include<fstream>
#include<string>
#include<sstream>
#include <iomanip> 
using namespace std;

//Variables :D
const float lvl1=380.00;
const float lvl2=450.00;
const float lvl3=550.00;
char min[5],mout[5];
char tin[5],tout[5];
char win[5],wout[5];
char thin[5],thout[5];
char fin[5],fout[5];
string cd;
char movri[5];  char tovri[5];  char wovri[5];  char thovri[5];  char fovri[5];
char movro[5];  char tovro[5];  char wovro[5];  char thovro[5];  char fovro[5];


void monfri(void)
{
ofstream qwe;
qwe.open("dtr.txt");

	cout<<"\n\n - Monday    - Time IN :";cin>>min;
	cout<<"\n - Monday    - Time OUT :";cin>>mout;
    cout<<"\n Enter Mon Overtime IN  : ";cin>>movri;
	cout<<"\n Enter Mon Overtime OUT : ";cin>>movro;

	cout<<"\n - Tuesday   - Time IN :";cin>>tin;
	cout<<"\n - Tuesday   - Time OUT :";cin>>tout;
    cout<<"\n Enter Tue Overtime IN  : ";cin>>tovri;
	cout<<"\n Enter Tue Overtime OUT : ";cin>>tovro;

	cout<<"\n - Wednesday - Time IN :";cin>>win;
	cout<<"\n - Wednesday - Time OUT :";cin>>wout;
    cout<<"\n Enter Wed Overtime IN  : ";cin>>wovri;
    cout<<"\n Enter Wed Overtime OUT : ";cin>>wovro;

	cout<<"\n - Thursday  - Time IN :";cin>>thin;
	cout<<"\n - Thursday  - Time OUT :";cin>>thout;
    cout<<"\n Enter Thurs Overtime IN  : ";cin>>thovri;
	cout<<"\n Enter Thurs Overtime OUT : ";cin>>thovro;

	cout<<"\n - Friday    - Time IN :";cin>>fin;
	cout<<"\n - Friday    - Time OUT :";cin>>fout;
    cout<<"\n Enter Fri Overtime IN  : ";cin>>fovri;
	cout<<"\n Enter Fri Overtime OUT : ";cin>>fovro;

	cout<<"\n Coverage Date : ";cin>>cd;

qwe<<" - Monday - \n Time IN : "<<min<<"\t"<<" Time OUT : "<<mout<<endl;
qwe<<" Overtime IN : "<<movri<<"\t"<<" Overtime OUT : "<<movro<<endl<<endl;
qwe<<" - Tuesday - \n Time IN : "<<tin<<"\t"<<" Time OUT : "<<tout<<endl;
qwe<<" Overtime IN : "<<tovri<<"\t"<<" Overtime OUT : "<<tovro<<endl<<endl;
qwe<<" - Wednesday - \n Time IN : "<<win<<"\t"<<" Time OUT : "<<wout<<endl;
qwe<<" Overtime IN : "<<wovri<<"\t"<<" Overtime OUT : "<<wovro<<endl<<endl;
qwe<<" - Thursday - \n Time IN : "<<thin<<"\t"<<" Time OUT : "<<thout<<endl;
qwe<<" Overtime IN : "<<thovri<<"\t"<<" Overtime OUT : "<<thovro<<endl<<endl;
qwe<<" - Friday - \n Time IN : "<<fin<<"\t"<<" Time OUT : "<<fout<<endl;
qwe<<" Overtime IN : "<<fovri<<"\t"<<fovro<<endl<<endl;
qwe<<" Coverage Date : "<<cd<<endl;
qwe.close();

}


//-------------------------------------------------------------------------------------------------------



int lvlone( string e_code , string  e_name , string e_level )
{
	cout<<"\n\n Enter Total Number Of Work Hour < Mon - Fri > : ";int TNWH1;cin>>TNWH1;
    cout<<" Enter Total Number Of Overtime Work Hour < Mon - Fri > : ";int TNOWH1; cin>>TNOWH1;
float Holiday=380/8*1.1;
float HR=380/8;
float OvrI=TNOWH1*52.25;
float RegI=HR*TNWH1;
float WGSI=RegI+OvrI;
float Tax=.1*WGSI;
float GSIS=380*.01;
float WNSI=(WGSI-(Tax+GSIS)+500);
system("cls");
system("color 03");
cout<<"\n\n Employee Code  : "<<e_code;
cout<<"\n Employee Name  : "<<e_name;
cout<<"\n Employee Level : "<<e_level;
cout<<"\n\n Coverage Date  : "<<cd;
cout<<"\n\n Total Number of Work Hours : "<<TNWH1<<" hrs";
cout<<"\n\n Regular Income : Php "<<RegI;
cout<<"\n Overtime Income : Php "<<OvrI;
cout<<"\n Weekly Gross Salary : Php "<<WGSI;
cout<<"\n\n \5 Deductions \5\n   - Tax  : Php "<<Tax<<"\n   - GSIS : Php "<<GSIS<<"\n\n"; 
cout<<" Net Salary Income : Php "<<WNSI;

return 1;

}

//------------------------------------------------------------------------------------------------------

int lvltwo( string e_code , string  e_name , string e_level )
{
cout<<"\n\n Enter Total Number Of Work Hour < Mon - Fri > : ";int TNWH2;cin>>TNWH2;
cout<<" Enter Total Number Of Overtime Work Hour < Mon - Fri > : ";int TNOWH2; cin>>TNOWH2;
float Holiday=450/8*1.1;
float HR=450/8;
float OvrI=TNOWH2*61.875;
float RegI=HR*TNWH2;
float WGSI=RegI+OvrI;
float Tax=.1*WGSI;
float GSIS=450*.015;
float WNSI=(WGSI-(Tax+GSIS)+500);
system("cls");
system("color 03");
cout<<"\n\n Employee Code  : "<<e_code;
cout<<"\n Employee Name  : "<<e_name;
cout<<"\n Employee Level : "<<e_level;
cout<<"\n\n Coverage Date  : "<<cd;
cout<<"\n\n Total Number of Work Hours : "<<TNWH2<<" hrs";
cout<<"\n\n Regular Income : Php "<<RegI;
cout<<"\n Overtime Income : Php "<<OvrI;
cout<<"\n Weekly Gross Salary : Php "<<WGSI;
cout<<"\n\n \5 Deductions \5\n   - Tax  : Php "<<Tax<<"\n   - GSIS : Php "<<GSIS<<"\n\n"; 
cout<<" Net Salary Income : Php "<<WNSI;

return 2;

}

//------------------------------------------------------------------------------------------------------

int lvlthree( string e_code , string  e_name , string e_level )
{
cout<<"\n\n Enter Total Number Of Work Hour < Mon - Fri > : ";int TNWH3;cin>>TNWH3;
cout<<" Enter Total Number Of Overtime Work Hour < Mon - Fri > : ";int TNOWH3; cin>>TNOWH3;
float Holiday=550/8*1.1;
float HR=550/8;
float OvrI=TNOWH3*52.25;
float RegI=HR*TNWH3;
float WGSI=RegI+OvrI;
float Tax=.1*WGSI;
float GSIS=550*.02;
float WNSI=(WGSI-(Tax+GSIS)+500);
system("cls");
system("color 03");
cout<<"\n\n Employee Code  : "<<e_code;
cout<<"\n Employee Name  : "<<e_name;
cout<<"\n Employee Level : "<<e_level;
cout<<"\n\n Coverage Date  : "<<cd;
cout<<"\n\n Total Number of Work Hours : "<<TNWH3<<" hrs";
cout<<"\n\n Regular Income : Php "<<RegI;
cout<<"\n Overtime Income : Php "<<OvrI;
cout<<"\n Weekly Gross Salary : Php "<<WGSI;
cout<<"\n\n \5 Deductions \5\n   - Tax  : Php "<<Tax<<"\n   - GSIS : Php "<<GSIS<<"\n\n"; 
cout<<" Net Salary Income : Php "<<WNSI;

return 3;

}

//------------------------------------------------------------------------------------------------------

int main()
{
string display,Id;
string e_name="",e_code="",e_level="";
ifstream record("employee.txt");

if(record.is_open())

{

	system("color 03");
cout<<"\n\n \6 Enter Employee Code :";
cin>>Id;
    system("cls");
while(!record.eof())
{
	getline(record,display);
	istringstream iss(display);
	int location=display.find(Id);
if(location>0)
{iss>>e_name>>e_code>>e_level;
}
}
    system("color 02");
cout<<"\n Employee Code  : "<<e_code<<endl;
cout<<" Employee Name  : "<<e_name<<endl;
cout<<" Employee Level : "<<e_level<<endl;
record.close();

}

monfri();

zxc:

cout<<"\n Re-Input Employee Level : ";int reinlvl;cin>>reinlvl;
switch (reinlvl){case 1: lvlone(e_code,e_name,e_level);break;case 2: lvltwo(e_code,e_name,e_level); break;case 3: lvlthree(e_code,e_name,e_level);break;  default:cout<<"\n\n Wrong Input \n\n"; goto zxc;}
cout<<"\n\n\n\n\n\n";


return 1;
}

Please state where you have errors and also the error messages the compiler gives so that we can help you faster

And also learn to indent your code and use newlines to make the code readable
Topic archived. No new replies allowed.