I have a lab due for school and the professor coded it for us in class today, but he always leaves errors (not to test us, but rather because he shouldn't be teaching/coding at all)
i have the correct output but in my output is a command not found error for some reason.
# MUST use a loop
# MUST prompt user for input data
# MUST use ecoh for calculation
# Program that computes a payroll for a small company
# 11.17.2022
# Johnathon Masias
# ITSC 1307 FALL
# Scripting Lab 8
# Variable declaration
rate=0
hours=0
gross=0
counter=0
# Using a loop to collect data
while [[ $counter -lt 3 ]]
do
echo "Please enter employee name"
read name
echo "Please enter hours worked"
read hours
echo "Please enter hourly rate"
read rate
# Compute gross pay using IF statement for overtime
if [[ `"$hours"` -le 40 ]]
then
gross=`echo "scale=2; $hours * $rate" | bc`
else
gross=`echo "scale=2; (40 * $rate) + ($hours - 40)*($rate*1.5)" | bc`
fi
echo "$name worked $hours at a rate of $rate making a gross pay of $gross"
read dummy
counter=`expr $counter + 1`
done
and my output copied and pasted:
Please enter employee name
a
Please enter hours worked
30.20
Please enter hourly rate
10.25
script08: line 30: 30.20: command not found
a worked 30.20 at a rate of 10.25 making a gross pay of 309.55
i force close the app after that because i know the math is working, even for the overtime cases. can anyone explain why this error is coming up? we don't use shebangs; he never taught us to use them and again he really really really should not be a programming professor.