-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
68 lines (47 loc) · 1.24 KB
/
main.go
File metadata and controls
68 lines (47 loc) · 1.24 KB
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
package main
import (
"bank/accounts"
"bank/holders"
"fmt"
"os"
)
func paymentsBills(conta verificarConta, valorDoBoleto float64) {
conta.Pay(valorDoBoleto)
}
type verificarConta interface {
Pay(valor float64) string
}
func main() {
holderAlfredo := holders.Holder{"Alfredo", "129.092.076-17", "Developer", 1800}
accountAlfredo := accounts.CurrentAccount{holderAlfredo, 001, 4760850, 5, 0260, "Nu Pagamentos S.A - Instituição Financeira", 1800}
//paymentsBills(&accountAlfredo, 60)
fmt.Println(accountAlfredo.AccountBalance)
fmt.Println(accountAlfredo)
showMenu()
cdmOp := readCmd()
switch cdmOp {
case 1:
accounts.OpTransfer()
case 2:
accounts.OpDeposit()
case 0:
fmt.Println("Exit")
os.Exit(0)
default:
fmt.Println("Unrecognized command.")
}
}
//func for show the menu
func showMenu() {
fmt.Println(" What operation do you want accomplish?")
fmt.Println("1- Transfer - TED")
fmt.Println("2- Deposit")
fmt.Println("0- Sair do Programa")
}
//func for read command of menu
func readCmd() int {
var readedCmd int //var for read user command
fmt.Scan(&readedCmd) //recive user command
fmt.Println("The chosen command was: ", readedCmd) //show the user command recived
return readedCmd
}