-
Notifications
You must be signed in to change notification settings - Fork 21
/
menu.go
42 lines (37 loc) · 897 Bytes
/
menu.go
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
package main
import (
"fmt"
"strings"
)
type Menu struct {
itemNo uint
itemName string
itemPrice float64
}
var menu = []Menu{
//itemNo itemName itemPrice
{1, "Adrakh Chai", 20},
{2, "Filter Coffee", 25},
{3, "Chhas", 35.50},
{4, "Lassi", 30},
{5, "Mango Lassi", 60},
{6, "Kadi Chaawal", 50},
{7, "Chhole Bhature", 45},
{8, "Khasta Kachori", 30},
{9, "Raj Kachori", 30},
{10, "Veg. Sandwich", 20},
{11, "Veg. Masala Maggi", 60.00},
{12, "Samosa", 20},
{13, "Cream Roll", 15},
}
func printMenu() {
fmt.Printf("%15s\n", "Menu")
fmt.Printf("%s\n", strings.Repeat("-", 35))
fmt.Printf("%-7s %6s %12s\n", "S.No.", "Price", "Item Name")
fmt.Printf("%s\n", strings.Repeat("-", 35))
for _, element := range menu {
fmt.Printf(" %-7d %.2f %-4s\n", element.itemNo, element.itemPrice, element.itemName)
}
fmt.Printf("%s", strings.Repeat("-", 35))
fmt.Println()
}