SHOW:
|
|
- or go back to the newest paste.
1 | #include <iostream> | |
2 | #include <string> | |
3 | using namespace std; | |
4 | ||
5 | string Lastname, Firstname, Middlename, Department; | |
6 | int Pagibig, PhilHealth, SSS, Grosspay, Dependent, Deductions, Hoursworked, Rate, OTPay, Netpay, Tax; | |
7 | char a; | |
8 | ||
9 | int main() | |
10 | { | |
11 | cout << "Enter to compute" << endl << endl; | |
12 | cout << "[A] Pay Roll Computation" << endl; | |
13 | cout << "[B] Budget Monitoring" << endl; | |
14 | cout << "[C] Exit" << endl; | |
15 | ||
16 | cin >> a; | |
17 | system("cls"); | |
18 | ||
19 | switch (a) | |
20 | { | |
21 | case 'A': | |
22 | ||
23 | cout << "Payroll Computation" << endl; | |
24 | cout << "" << endl; | |
25 | cout << "Enter Employee's Lastname: "; | |
26 | cin >> Lastname; | |
27 | cout << "Enter Employee's Firstname: "; | |
28 | cin >> Firstname; | |
29 | cout << "Enter Employee's Middlename: "; | |
30 | cin >> Middlename; | |
31 | cout << "Department: "; | |
32 | cin >> Department; | |
33 | cout << "Number of Dependents: "; | |
34 | cin >> Dependent; | |
35 | cout << "Number of Hours Worked: "; | |
36 | cin >> Hoursworked; | |
37 | cout << "Enter Rate per Day: "; | |
38 | cin >> Rate; | |
39 | cout << endl << endl; | |
40 | ||
41 | ||
42 | - | OTpay = (Hoursworked- 40) * Rate * 0.25; |
42 | + | |
43 | - | GrossPay = 40 * Rate + OTpay; |
43 | + | OTPay = (Hoursworked- 40) * Rate * 0.25; |
44 | Grosspay = 40 * Rate + OTPay; | |
45 | } | |
46 | - | GrossPay = Hoursworked * Rate; |
46 | + | |
47 | Grosspay = Hoursworked * Rate; | |
48 | } | |
49 | ||
50 | cout << "Payslip" << endl; | |
51 | cout << "" << endl; | |
52 | cout << "Employee Name : " << Lastname << "," << Firstname << " " << Middlename << endl; | |
53 | cout << "Department : " << Department << endl; | |
54 | ||
55 | cout << endl << endl; | |
56 | ||
57 | cout << "Deductions" << endl; | |
58 | cout << endl << endl; | |
59 | ||
60 | if (Grosspay <= 5000) | |
61 | { | |
62 | SSS = 105; | |
63 | } | |
64 | ||
65 | else if (Grosspay >= 5001 && Grosspay <= 10000) | |
66 | { | |
67 | SSS = Grosspay * 0.05; | |
68 | } | |
69 | ||
70 | ||
71 | else if (Grosspay >= 10001 && Grosspay <= 15000) | |
72 | { | |
73 | SSS = Grosspay * 0.08 + 75; | |
74 | } | |
75 | ||
76 | else if (Grosspay > 15000) | |
77 | { | |
78 | SSS = Grosspay * 0.12 + 110; | |
79 | } | |
80 | else if (Dependent == 0) | |
81 | { | |
82 | - | else if (dependent == 0) |
82 | + | Tax = Grosspay * 0.12; |
83 | } | |
84 | - | tax = grosspay * 0.12; |
84 | + | else if (Dependent >= 1 && Dependent <= 2) |
85 | { | |
86 | - | else if (dependent >= 1 && dependent <= 2) |
86 | + | Tax = Grosspay * 0.08; |
87 | } | |
88 | - | tax = grosspay * 0.08; |
88 | + | else if (Dependent >= 3) |
89 | { | |
90 | - | else if (dependent >= 3) |
90 | + | Tax = Grosspay * 0.032; |
91 | } | |
92 | - | tax = Grosspay * 0.3; |
92 | + | |
93 | ||
94 | - | NetPay = Grosspay - deductions - tax; |
94 | + | |
95 | - | cout << "Net Pay: " << NetPay << endl; |
95 | + | |
96 | ||
97 | Pagibig = 100; | |
98 | ||
99 | cout << "Pagibig : " << Pagibig << endl; | |
100 | ||
101 | PhilHealth = 120; | |
102 | ||
103 | cout << "PhilHealth : " << PhilHealth << endl; | |
104 | ||
105 | cout << endl << endl; | |
106 | Deductions = SSS + PhilHealth + Pagibig; | |
107 | cout << "Total Deductions : " << Deductions << endl; | |
108 | Netpay = Grosspay - Deductions - Tax; | |
109 | cout << endl << endl; | |
110 | cout << "OT Pay : " << OTPay<< endl; | |
111 | cout << "Gross Pay : " << Grosspay << endl; | |
112 | cout << "NET PAY : " << Netpay<<endl; | |
113 | - | cout << "OT Pay : " << endl; |
113 | + | |
114 | system("pause"); | |
115 | - | cout << "NET PAY : " << endl; |
115 | + | |
116 | main(); | |
117 | ||
118 | break; | |
119 | ||
120 | case 'B': | |
121 | ||
122 | cout << " " << endl; | |
123 | system("pause"); | |
124 | system("CLS"); | |
125 | main(); | |
126 | ||
127 | break; | |
128 | ||
129 | case 'C': | |
130 | ||
131 | exit(0); | |
132 | ||
133 | break; | |
134 | ||
135 | default: | |
136 | ||
137 | cout << "Error! Invalid Answer " << endl; | |
138 | system("pause"); | |
139 | system("CLS"); | |
140 | main(); | |
141 | ||
142 | break; | |
143 | ||
144 | return 0; | |
145 | } | |
146 | } |