-1
我沒有得到正確的輸出結果。它不是將輸入與附加成本相乘,而是按照原來的方式顯示輸入。我需要將人數乘以他們可能基於選擇的額外費用。爲什麼我沒有得到正確的乘法輸出?
#!/bin/bash
read -p "Number of Adult Tickets:(0 for none) " integer1
read -p "Number of Junior Tickets:(0 for none) " integer2
echo ""
echo "$integer1 Adults"
echo "$integer2 Juniors"
echo ""
num1=$50
num2=$20
num3=$5
echo "Season Pass Add-On:"
echo "1)Add Seasonal Parking"
echo "2)Add Season Pass For Theme Park"
echo "7)Just Buy Tickets For Today"
echo "8)I wanna exit."
echo ""
read -p "What would the guest like to do? " guest
echo ""
case $guest in
1)
echo "Add Seasonal Parking"
echo ""
echo "Add an additional $num1 for every adult pass"
echo ""
echo "For Adult Tickets "$((integer1 + num1))""
echo "For Junior Tickets "$((integer2 + num1))""
;;
2)
echo "Add Season Pass For Theme Park"
echo ""
echo "Add an additional $num2 for every adult pass"
echo "Add an additional $num3 for every junior pass"
echo ""
echo "For Junior Tickets "$((integer2 * num2))""
echo "For Adult Tickets "$((integer1 * num3))""
echo "For Junior Tickets "$((integer2 * num2))""
echo "For Adult Tickets "$((integer1 * num3))""
;;
3)
echo "Just buy tickets for today"
exit 0
;;
4)
echo "invalid entry. You are exiting"
exit 1
;;
esac
exit 0
非常感謝! – pinook