-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUC-6-OptionalWhileWages.sh
More file actions
37 lines (31 loc) · 900 Bytes
/
UC-6-OptionalWhileWages.sh
File metadata and controls
37 lines (31 loc) · 900 Bytes
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
#!/bin/bash -x
isAbsent=0
isPartTime=1
isFullTime=2
maxRateInMonth=100
numOfWorkingDays=20
totalWorkingDays=0
empRatePerHr=20
totalEmpHr=0
while [[ $totalEmpHr -lt $maxRateInMonth || $totalWorkingDays -lt $numOfWorkingDays ]]
do
((totalWorkingDays++))
randomCheck=$((RANDOM%3))
case $randomCheck in
$isPartTime )
empHr=4
;;
$isFullTime )
empHr=8
((present++))
;;
*)
empHr=0
((absent++))
;;
esac
totalEmpHr=$(($totalEmpHr+$empHr))
done
presentDays=$(($present))
halfDay=$(($half))
totalSalary=$(($totalEmpHr*$empRatePerHr))