-
Notifications
You must be signed in to change notification settings - Fork 0
/
bookstore.go
39 lines (32 loc) · 841 Bytes
/
bookstore.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
//This ia an book store cli-app
package main
import (
"fmt"
"reflect"
)
//////////////// User interface ///////////////////////////////
type user struct {
userName string
userContact uint
userEmail string
userCart := make(map[string]float64)
)
// Prints user info
func (u *user) getUserInfo() {
fmt.Printf("User Name: %s\nUser Contact: %d\nUser Email: %s\n",
userName, userContact, userEmail)
}
// print users items out
func (u *user) getUserCart(cart map) {
fmt.Printf("Customer %s's Cart\n", userName)
fmt.Println("---------------------------------")
fmt.Println("ITEM\t\t\Price\n")
if cart != "map[]" {
for key, value := range cart {
fmt.Printf("%s\t\t%.2f", key, value)
}
} else {
fmt.Println("Note!: Nothing in the cart to display")
}
}
/////////////////////////////////////////////////////////////////