-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvariables.go
37 lines (25 loc) · 1006 Bytes
/
variables.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
package main
import "fmt"
func main() {
const conferenceTickets int = 50
var remainingTickets uint = 50
conferenceName := "Go Conference"
fmt.Printf("Welcome to %v booking application.\nWe have total of %v tickets and %v are still available.\nGet your tickets here to attend\n", conferenceName, conferenceTickets, remainingTickets)
var firstName string
var lastName string
var email string
var userTickets uint
// asking for user input
fmt.Println("Enter Your First Name: ")
fmt.Scanln(&firstName)
fmt.Println("Enter Your Last Name: ")
fmt.Scanln(&lastName)
fmt.Println("Enter Your Email: ")
fmt.Scanln(&email)
fmt.Println("Enter number of tickets: ")
fmt.Scanln(&userTickets)
// book ticket in system
remainingTickets = remainingTickets - userTickets
fmt.Printf("Thank you %v %v for booking %v tickets. You will receive a confirmation email at %v\n", firstName, lastName, userTickets, email)
fmt.Printf("%v tickets remaining for %v\n", remainingTickets, conferenceName)
}