-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUC-8-Array.sh
More file actions
executable file
·41 lines (36 loc) · 947 Bytes
/
UC-8-Array.sh
File metadata and controls
executable file
·41 lines (36 loc) · 947 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
38
39
40
41
#!/bin/bash -x
isPartTime=1
isFullTime=2
maxHoursInMonth=100
empRatePerHr=20
numOfWorkingDays=20
totalEmpHr=0
totalWorkingDays=0
function getWorkingHours()
{
case $1 in
$isFullTime )
empHrs=8
;;
$isPartTime )
empHrs=4
;;
*)
empHrs=0
;;
esac
}
function getEmpWage()
{
echo $(( $totalEmpHr*$empRatePerHr ))
}
while [[ $totalEmpHr -lt $maxHoursInMonth && $totalWorkingDays -lt $numOfWorkingDays ]]
do
((totalWorkingDays++))
randomCheck=$((RANDOM%3))
getWorkingHours $randomCheck
totalEmpHr=$(($totalEmpHr+$empHrs))
dailyWages[$totalWorkingDays]=$(($empHrs*$empRatePerHr))
done
totalSalary="$( getEmpWage $totalEmpHr )"
echo ${dailyWages[@]}