-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpay.java
More file actions
486 lines (408 loc) · 20.8 KB
/
Copy pathpay.java
File metadata and controls
486 lines (408 loc) · 20.8 KB
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
// Writen by Edgar Colin
// Aug 12th 2016
// Class: CIS163 Java I
// Prof: Michael Parmeley
// Section 14887
// HW 5 Problem 6 MODIFIED
// Filename: pay.java
import java.util.Scanner;
public class pay
{
public static void main(String[] args)
{
int skillSelection;
int benefitSelection1;
int benefitSelection2;
int benefitSelection3;
int savingSelection;
double grossPay;
double savingsRate;
double moneySaved;
double benefitCost1;
double benefitCost2;
double benefitCost3;
double pay;
double payRate;
double hoursWorked;
double overtimePay = 0;
double overtimepayRate;
double overtimeMult = 1.50;
double overtimeHours = 0; // Number of overtime hours worked
double afterdeductionPay;
Scanner userInput = new Scanner(System.in);
System.out.println("Please enter the Total number of hours worked this week.");
hoursWorked = userInput.nextDouble();
userInput.nextLine();
System.out.println("Please enter your skill level");
skillSelection = userInput.nextInt();
userInput.nextLine();
System.out.println("The hours you worked this week: " + hoursWorked);
System.out.println("Your skill level is: " + skillSelection);
if(hoursWorked > 40.00)
{
overtimeHours = hoursWorked - 40;
hoursWorked = 40;
}
System.out.println("The regular time worked this week: " + hoursWorked + " hrs");
System.out.println("The overtime worked this week: " + overtimeHours + " hrs");
switch(skillSelection)
{
case 3:
payRate = 22.00;
overtimepayRate = payRate*overtimeMult;
grossPay = overtimepayRate*overtimeHours + payRate*hoursWorked;
System.out.println("Pay rate : " + payRate + " $/hr");
System.out.println("Overtime pay rate : " + overtimepayRate + " $/hr");
System.out.println("Regular time pay : $" + payRate*hoursWorked + " per week" );
System.out.println("Overtime time pay : $" + overtimepayRate*overtimeHours + " per week" );
System.out.println("Gross Pay : $" + grossPay + " per week");
System.out.println(
"Enter an optional available benefit from below: "
+"\n"
+"Available Benefits\n"
+"-----------------------------\n"
+"(1) Medical Insurance $32.25 \n"
+"(2) Dental Insurance $20.00 \n"
+"(3) Long term life $10.00 \n"
+"-----------------------------\n"
+">> ");
System.out.println("If you want benefit (1) Medical Insurance, Enter 1, To skip benefit, press 0: ");
benefitSelection1 = userInput.nextInt();
userInput.nextLine();
System.out.println("If you want benefit (2) Dental Insurance, Enter 2, To skip benefit, press 0: ");
benefitSelection2 = userInput.nextInt();
userInput.nextLine();
System.out.println("If you want benefit (3) Long term life Insurance, Enter 3 , To skip benefit, press 0: ");
benefitSelection3 = userInput.nextInt();
userInput.nextLine();
System.out.print("Benefit Selections are: " + benefitSelection1 + ", "
+ benefitSelection2 + ", " + benefitSelection3 );
if(benefitSelection1 == 1)
{
System.out.println("\n");
System.out.println("You have acquired benefit 1!!!");
benefitCost1 = 32.25;
System.out.println("Benefit (1) Medical Insurance Cost = " + benefitCost1 +" per week");
}
else
{
System.out.println("\n");
System.out.println("You skipped out of Benefit 1");
benefitCost1 = 0;
System.out.println("Benefit (1) Medical Insurance Cost = " + benefitCost1 +" per week");
}
if(benefitSelection2 == 2)
{
System.out.println("\n");
System.out.println("You have acquired benefit 2!!!");
benefitCost2 = 20.00;
System.out.println("Benefit (2) Dental Insurance Cost = " + benefitCost2 +" per week");
}
else
{
System.out.println("\n");
System.out.println("You skipped out of benefit 2");
benefitCost2 = 0;
System.out.println("Benefit (2) Dental Insurance Cost = " + benefitCost2 +" per week");
}
if(benefitSelection3 == 3)
{
System.out.println("\n");
System.out.println("You have acquired benefit 3!!!");
benefitCost3 = 10.00;
System.out.println("Benefit (3) Long term life Insurance Cost = " + benefitCost3 +" per week");
}
else
{
System.out.println("\n");
System.out.println("You skipped out of benefit 3");
benefitCost3 = 0;
System.out.println("Benefit (3) Long term life Insurance Cost = " + benefitCost3 +" per week");
}
System.out.println("\n");
System.out.println("Your skil level qualifies you to participate\n" +
"in a retirement plan at 3% of their gross pay. \n" +
"If you want to participate, Press (1). If not Press (2). ");
savingSelection = userInput.nextInt();
if(savingSelection == 1)
{
System.out.println("\n");
System.out.println("You have elected to be in the savings plan");
savingsRate = 0.03;
moneySaved = savingsRate*grossPay;
System.out.println("Money Saved: " + moneySaved);
}
else
{
System.out.println("\n");
System.out.println("You have declined to be in the savings plan");
savingsRate = 0.0;
moneySaved = savingsRate*grossPay;
System.out.println("Money Saved: " + moneySaved);
}
afterdeductionPay = grossPay - (benefitCost1 + benefitCost2 + benefitCost3 + moneySaved);
if(afterdeductionPay > 0)
{
System.out.println("\n");
System.out.println("**************Pay Summary*****************");
System.out.println("Regular time pay : $" + payRate*hoursWorked + " per week" );
System.out.println("Overtime time pay : $" + overtimepayRate*overtimeHours + " per week" );
System.out.println("Gross Pay : $" + grossPay + " per week");
System.out.println("Money Saved Deduction : $" + moneySaved + " per week");
System.out.println("Benefit (1) Medical Insurance Cost = $" + benefitCost1 +" per week");
System.out.println("Benefit (2) Dental Insurance Cost = $" + benefitCost2 +" per week");
System.out.println("Benefit (3) Long term life Insurance Cost = " + benefitCost3 +" per week");
System.out.println("________________________________________________________________________");
System.out.println("Pay After Deductions : $" + afterdeductionPay);
System.out.println("________________________________________________________________________");
}
else
{
System.out.println("");
System.out.println("Error*** Gross Pay amount < Deductions, Balance $" + afterdeductionPay);
System.out.println("TRY AGAIN!!!!!!");
}
break;
case 2:
payRate = 20.00;
overtimepayRate = payRate*overtimeMult;
grossPay = overtimepayRate*overtimeHours + payRate*hoursWorked;
System.out.println("Pay rate : " + payRate + " $/hr");
System.out.println("Overtime pay rate : " + overtimepayRate + " $/hr");
System.out.println("Regular time pay : $" + payRate*hoursWorked + " per week" );
System.out.println("Overtime time pay : $" + overtimepayRate*overtimeHours + " per week" );
System.out.println("Gross Pay : $" + grossPay + " per week");
System.out.println(
"Enter an optional available benefit from below: "
+"\n"
+"Available Benefits\n"
+"-----------------------------\n"
+"(1) Medical Insurance $32.25 \n"
+"(2) Dental Insurance $20.00 \n"
+"(3) Long term life $10.00 \n"
+"-----------------------------\n"
+">> ");
System.out.println("If you want benefit (1) Medical Insurance, Enter 1, To skip benefit, press 0: ");
benefitSelection1 = userInput.nextInt();
userInput.nextLine();
System.out.println("If you want benefit (2) Dental Insurance, Enter 2, To skip benefit, press 0: ");
benefitSelection2 = userInput.nextInt();
userInput.nextLine();
System.out.println("If you want benefit (3) Long term life Insurance, Enter 3 , To skip benefit, press 0: ");
benefitSelection3 = userInput.nextInt();
userInput.nextLine();
System.out.print("Benefit Selections are: " + benefitSelection1 + ", "
+ benefitSelection2 + ", " + benefitSelection3 );
if(benefitSelection1 == 1)
{
System.out.println("\n");
System.out.println("You have acquired benefit 1!!!");
benefitCost1 = 32.25;
System.out.println("Benefit (1) Medical Insurance Cost = " + benefitCost1 +" per week");
}
else
{
System.out.println("\n");
System.out.println("You skipped out of Benefit 1");
benefitCost1 = 0;
System.out.println("Benefit (1) Medical Insurance Cost = " + benefitCost1 +" per week");
}
if(benefitSelection2 == 2)
{
System.out.println("\n");
System.out.println("You have acquired benefit 2!!!");
benefitCost2 = 20.00;
System.out.println("Benefit (2) Dental Insurance Cost = " + benefitCost2 +" per week");
}
else
{
System.out.println("\n");
System.out.println("You skipped out of benefit 2");
benefitCost2 = 0;
System.out.println("Benefit (2) Dental Insurance Cost = " + benefitCost2 +" per week");
}
if(benefitSelection3 == 3)
{
System.out.println("\n");
System.out.println("You have acquired benefit 3!!!");
benefitCost3 = 10.00;
System.out.println("Benefit (3) Long term life Insurance Cost = " + benefitCost3 +" per week");
}
else
{
System.out.println("\n");
System.out.println("You skipped out of benefit 3");
benefitCost3 = 0;
System.out.println("Benefit (3) Long term life Insurance Cost = " + benefitCost3 +" per week");
}
/*System.out.println("\n");
System.out.println("Your skil level qualifies you to participate\n" +
"in a retirement plan at 3% of their gross pay. \n" +
"If you want to participate, Press (1). If not Press (2). ");
savingSelection = userInput.nextInt();
if(savingSelection == 1)
{
System.out.println("\n");
System.out.println("You have elected to be in the savings plan");
savingsRate = 0.03;
moneySaved = savingsRate*grossPay;
System.out.println("Money Saved: " + moneySaved);
}
else
{
System.out.println("\n");
System.out.println("You have declined to be in the savings plan");
savingsRate = 0.0;
moneySaved = savingsRate*grossPay;
System.out.println("Money Saved: " + moneySaved);
}
*/
afterdeductionPay = grossPay - (benefitCost1 + benefitCost2 + benefitCost3);
if(afterdeductionPay > 0)
{
System.out.println("\n");
System.out.println("**************Pay Summary*****************");
System.out.println("Regular time pay : $" + payRate*hoursWorked + " per week" );
System.out.println("Overtime time pay : $" + overtimepayRate*overtimeHours + " per week" );
System.out.println("Gross Pay : $" + grossPay + " per week");
//System.out.println("Money Saved Deduction : $" + moneySaved + " per week");
System.out.println("Benefit (1) Medical Insurance Cost = $" + benefitCost1 +" per week");
System.out.println("Benefit (2) Dental Insurance Cost = $" + benefitCost2 +" per week");
System.out.println("Benefit (3) Long term life Insurance Cost = " + benefitCost3 +" per week");
System.out.println("________________________________________________________________________");
System.out.println("Pay After Deductions : $" + afterdeductionPay);
System.out.println("________________________________________________________________________");
}
else
{
System.out.println("");
System.out.println("Error*** Gross Pay amount < Deductions, Balance $" + afterdeductionPay);
System.out.println("TRY AGAIN!!!!!!");
}
break;
case 1:
payRate = 17.00;
overtimepayRate = payRate*overtimeMult;
grossPay = overtimepayRate*overtimeHours + payRate*hoursWorked;
System.out.println("Pay rate : " + payRate + " $/hr");
System.out.println("Overtime pay rate : " + overtimepayRate + " $/hr");
System.out.println("Regular time pay : $" + payRate*hoursWorked + " per week" );
System.out.println("Overtime time pay : $" + overtimepayRate*overtimeHours + " per week" );
System.out.println("Gross Pay : $" + grossPay + " per week");
/*
System.out.println(
"Enter an optional available benefit from below: "
+"\n"
+"Available Benefits\n"
+"-----------------------------\n"
+"(1) Medical Insurance $32.25 \n"
+"(2) Dental Insurance $20.00 \n"
+"(3) Long term life $10.00 \n"
+"-----------------------------\n"
+">> ");
System.out.println("If you want benefit (1) Medical Insurance, Enter 1, To skip benefit, press 0: ");
benefitSelection1 = userInput.nextInt();
userInput.nextLine();
System.out.println("If you want benefit (2) Dental Insurance, Enter 2, To skip benefit, press 0: ");
benefitSelection2 = userInput.nextInt();
userInput.nextLine();
System.out.println("If you want benefit (3) Long term life Insurance, Enter 3 , To skip benefit, press 0: ");
benefitSelection3 = userInput.nextInt();
userInput.nextLine();
System.out.print("Benefit Selections are: " + benefitSelection1 + ", "
+ benefitSelection2 + ", " + benefitSelection3 );
if(benefitSelection1 == 1)
{
System.out.println("\n");
System.out.println("You have acquired benefit 1!!!");
benefitCost1 = 32.25;
System.out.println("Benefit (1) Medical Insurance Cost = " + benefitCost1 +" per week");
}
else
{
System.out.println("\n");
System.out.println("You skipped out of Benefit 1");
benefitCost1 = 0;
System.out.println("Benefit (1) Medical Insurance Cost = " + benefitCost1 +" per week");
}
if(benefitSelection2 == 2)
{
System.out.println("\n");
System.out.println("You have acquired benefit 2!!!");
benefitCost2 = 20.00;
System.out.println("Benefit (2) Dental Insurance Cost = " + benefitCost2 +" per week");
}
else
{
System.out.println("\n");
System.out.println("You skipped out of benefit 2");
benefitCost2 = 0;
System.out.println("Benefit (2) Dental Insurance Cost = " + benefitCost2 +" per week");
}
if(benefitSelection3 == 3)
{
System.out.println("\n");
System.out.println("You have acquired benefit 3!!!");
benefitCost3 = 10.00;
System.out.println("Benefit (3) Long term life Insurance Cost = " + benefitCost3 +" per week");
}
else
{
System.out.println("\n");
System.out.println("You skipped out of benefit 3");
benefitCost3 = 0;
System.out.println("Benefit (3) Long term life Insurance Cost = " + benefitCost3 +" per week");
}
/*System.out.println("\n");
System.out.println("Your skil level qualifies you to participate\n" +
"in a retirement plan at 3% of their gross pay. \n" +
"If you want to participate, Press (1). If not Press (2). ");
savingSelection = userInput.nextInt();
if(savingSelection == 1)
{
System.out.println("\n");
System.out.println("You have elected to be in the savings plan");
savingsRate = 0.03;
moneySaved = savingsRate*grossPay;
System.out.println("Money Saved: " + moneySaved);
}
else
{
System.out.println("\n");
System.out.println("You have declined to be in the savings plan");
savingsRate = 0.0;
moneySaved = savingsRate*grossPay;
System.out.println("Money Saved: " + moneySaved);
}
*/
afterdeductionPay = grossPay - 0; //(benefitCost1 + benefitCost2 + benefitCost3);
if(afterdeductionPay > 0)
{
System.out.println("\n");
System.out.println("**************Pay Summary*****************");
System.out.println("Regular time pay : $" + payRate*hoursWorked + " per week" );
System.out.println("Overtime time pay : $" + overtimepayRate*overtimeHours + " per week" );
System.out.println("Gross Pay : $" + grossPay + " per week");
//System.out.println("Money Saved Deduction : $" + moneySaved + " per week");
//System.out.println("Benefit (1) Medical Insurance Cost = $" + benefitCost1 +" per week");
//System.out.println("Benefit (2) Dental Insurance Cost = $" + benefitCost2 +" per week");
//System.out.println("Benefit (3) Long term life Insurance Cost = " + benefitCost3 +" per week");
System.out.println("________________________________________________________________________");
System.out.println("Weekly Pay : $" + afterdeductionPay);
System.out.println("________________________________________________________________________");
}
else
{
System.out.println("");
System.out.println("Error*** Gross Pay amount < Deductions, Balance $" + afterdeductionPay);
System.out.println("TRY AGAIN!!!!!!");
}
break;
default: System.out.print("\n");
System.out.print("*****************************************************************************\n");
System.out.print("***ERROR SKILL LEVEL SELECTED IS INVALID: SELECT VALUE 1,2 or 3 TRY AGAIN****\n");
System.out.print("*****************************************************************************\n");
break;
}
}
}