AVAILABLE: 5
This is a historical relic from studying Linux during the second semester at university. Basic logic programming often begins with simple case studies using a basic environment. What better choice than the command line (cmd)? Everything was cmd, terminal, and similar tools.
Program:
#!/bin/sh
#12131294.sh
#Employee Salary
#date: 10/05/14
for i in $(ls); do
echo "--------------------------"
echo "--------------------------"
echo "1. Input Data"
echo "2. Display Data"
echo "3. Exit"
echo -n "Choice: "
read CHOICE
case $CHOICE in
1)
echo -n "Basic Salary: "
read basic_salary
echo -n "Marriage Allowance: "
read marriage_allowance
if [ "$marriage_allowance" -eq 0 ]
then
marriage_bonus=0
else
marriage_bonus=70000
fi
echo -n "Child Allowance: "
read child_allowance
if [ "$child_allowance" -eq 0 ]
then
child_bonus=0
else
child_bonus=50000
fi
;;
2)
echo
total_salary=$[basic_salary + marriage_allowance + child_allowance]
total_tax=$[100000 + marriage_bonus + child_bonus]
net_salary=$[total_salary - total_tax]
echo "Total Salary: $total_salary"
echo "Total Tax: $total_tax"
echo "Net Salary: $net_salary"
;;
3)
exit
;;
*)
echo "Sorry, the option you selected is not available!"
;;
esac
done
Output:
"Hope this is useful and happy learning!"