-
Notifications
You must be signed in to change notification settings - Fork 12
/
methods.go
24 lines (19 loc) · 916 Bytes
/
methods.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
// Declare a new struct type to hold information about a tennis player,
// including the number of matches played and the number won. Add a method to
// this type that calculates the win ratio for the player. Create a new
// player, and output the win ratio for them.
//
// Template available at: http://play.golang.org/p/jnBw-jtE3n
package main
// Add your imports here.
// Declare a struct type `player` to maintain information about a player.
// Declare a method that calculates the win ratio for the player. Note that
// you'll likely need to convert one or more values to floats, which can be
// done like: float32(intValue)
func ( /* receiver */ ) funcName() /* return type */ {
}
func main() {
// Create a new player, and output their win ratio.
// If you're feeling adventurous, try creating a slice of multiple players
// and iterating over the slice, displaying the player name and win ratio.
}