Share
Explore BrainMass

Unix Shell Script to Calculate Total Pay and Net Pay

Develop a Unix shell script to input number of hours worked and pay rate and calculate the total pay, then the social security amount (assume 5%), then the net pay. Do this as a loop until the number of hours worked is zero.

Solution Preview

The following script inputs hours worked and pay rate to calculate grossPay. It calculates the social security amount by multiplying the social security rate 5% with the grossPay. Next it deducts this social security amount from the grossPay to calculate the net pay amount. Please remember that bash variables cannot store ...

Solution Summary

The following script inputs hours worked and pay rate to calculate grossPay. It calculates the social security amount by multiplying the social security rate 5% with the grossPay. Next it deducts this social security amount from the grossPay to calculate the net pay amount. Please remember that bash variables cannot store fractions, so it is wise to use the utility bc instead of bash. However, in this case we have not used "bc".

$2.19