-
Notifications
You must be signed in to change notification settings - Fork 0
/
Fast Food Restaurant Management System in Shell Script Linux Project.txt
101 lines (91 loc) · 2.64 KB
/
Fast Food Restaurant Management System in Shell Script Linux Project.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/bash
# Function to display the menu
display_menu() {
echo "Menu Card:"
echo "1. Pizza - Rs. 200"
echo "2. Burger - Rs. 150"
echo "3. Subway - Rs. 180"
echo "4. Samosa - Rs. 20"
echo "5. Vadapav - Rs. 30"
echo "6. Pav Bhaji - Rs. 120"
echo "7. Manchurian - Rs. 180"
echo "8. Sandwich - Rs. 100"
echo "0. Place Order and Exit"
echo ""
}
# Function to process the user's choice
process_choice() {
case $1 in
1)
echo "You selected Pizza - Rs. 200"
selected_items+=(["Pizza"]=200)
;;
2)
echo "You selected Burger - Rs. 150"
selected_items+=(["Burger"]=150)
;;
3)
echo "You selected Subway - Rs. 180"
selected_items+=(["Subway"]=180)
;;
4)
echo "You selected Samosa - Rs. 20"
selected_items+=(["Samosa"]=20)
;;
5)
echo "You selected Vadapav - Rs. 30"
selected_items+=(["Vadapav"]=30)
;;
6)
echo "You selected Pav Bhaji - Rs. 120"
selected_items+=(["Pav Bhaji"]=120)
;;
7)
echo "You selected Manchurian - Rs. 180"
selected_items+=(["Manchurian"]=180)
;;
8)
echo "You selected Sandwich - Rs. 100"
selected_items+=(["Sandwich"]=100)
;;
0)
echo "Placing your order..."
# Add your logic to process the order here
calculate_total
echo "Thank you for ordering. Enjoy your meal!"
exit 0
;;
*)
echo "Invalid choice. Please try again."
;;
esac
}
# Function to calculate the total price
calculate_total() {
total=0
for item in "${selected_items[@]}"; do
total=$((total + item))
done
echo "Total Price: Rs. $total"
}
# Main program loop
declare -A selected_items
while true; do
display_menu
read -p "Enter the item number to select (0-8, separate multiple items with spaces): " choices
echo ""
# Split the user's input into an array of choices
read -ra selected <<< "$choices"
# Process each selected item
for item in "${selected[@]}"; do
process_choice $item
done
echo "You have selected the following items:"
# Display the selected items and their prices
for item in "${!selected_items[@]}"; do
price=${selected_items[$item]}
echo "$item - Rs. $price"
done
calculate_total
echo ""
done