PAYBILL
PREPARATION:
echo -e "\tPAYBILL CALCULATION"
echo -e "\t~~~~~~~~~~~~~~~~~~~~"
echo -e "\tenter the n value"
read n
echo -e "\tenter name id salary"
for((i=1;i<=n;i++))
do
`read name id salary
echo -e "\tbefore calculation"
echo -e "\t***********************"
echo -e "\tname\t:$name\n\tid\t:$id\n\tsalary\t:$salary"
echo -e "\t***********************"
echo -e "\t calculation part"
if [ $salary -lt 10000 ]
then
lic=`expr $salary*0.05|bc`
echo -e "\n\tlic:\t"$lic
pf=`expr $salary*0.03|bc`
echo -e "\n\tpf:\t"$pf
ded=`expr $lic+$pf|bc`
echo -e "\n\tded:\t"$ded
hra=`expr $salary*0.03|bc`
echo -e "\n\thra:\t"$hra
da=`expr $salary*0.08|bc`
echo -e "\n\tda:\t"$da
add=`expr $hra+$da|bc`
echo -e "\n\tadd:\t"$add
gpay=`expr $salary-$ded|bc`
echo -e "\n\tgpay:\t"$gpay
npay=`expr $gpay+$add|bc`
echo -e "\n\tnpay:\t"$npay
echo -e "\n\tafter calculation"
echo -e "\n\t*********************"
echo -e "\n\tname\t:$name\n\tid\t:$id\n\tnetpay\t:$npay"
echo -e "\n\t***********************"
else
lic=`expr $salary*0.05|bc`
echo -e "\n\tlic:\t"$lic
pf=`expr $salary*0.03|bc`
echo -e "\n\tpf:\t"$pf
ded=`expr $lic+$pf|bc`
echo -e "\n\tded:\t"$ded
hra=`expr $salary*0.03|bc`
echo -e "\n\thra:\t"$hra
da=`expr $salary*0.08|bc`
echo -e "\n\tda:\t"$da
add=`expr $hra+$da|bc`
echo -e "\n\tadd:\t"$add
gpay=`expr $salary-$ded|bc`
echo -e "\n\tgpay:\t"$gpay
npay=`expr $gpay+$add|bc`
echo -e "\n\tnpay:\t"$npay
echo -e "\n\tafter calculation"
echo -e "\n\t*********************"
echo -e "\n\tname\t:$name\n\tid\t:$id\n\tnetpay\t:$npay"
echo -e "\n\t***********************"
fi
done
OUTPUT:
[@localhost
~]$ sh paybill.sh
PAYBILL CALCULATION
~~~~~~~~~~~~~~~~~~~~
enter the n value
2- INSERT
--
enter name id salary
rajasekar
324 100000
before calculation
***********************
name
:rajasekar
id
:324
salary
:100000
***********************
calculation part
lic:
5000.00
pf:
3000.00
ded:
8000.00
hra:
3000.00
da:
8000.00
add:
11000.00
gpay:
92000.00
npay:
103000.00
after calculation
*********************
name
:rajasekar
id
:324
netpay
:103000.00
***********************