Mode:
Duration:
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
package main
import "fmt"
type BankAccount struct {
Owner string
Balance float64
}
func (b BankAccount) Display() {
fmt.Println("Owner:", b.Owner)
fmt.Println("Balance:", b.Balance)
}
func (b *BankAccount) Deposit(amount float64) {
b.Balance += amount
}
func main() {
account := BankAccount{Owner: "Alice", Balance: 1000}
account.Display()
account.Deposit(250)
fmt.Println("After Deposit:")
account.Display()
}Coding works best on desktop or with an external keyboard.