The garden has two rectangular beds. Write the method Area() on Bed to return the bed's area (width times length); main shows each bed's area.
6 20
package main
import "fmt"
type Bed struct {
Width int
Length int
}
func (b Bed) Area() int {
// your code here: return b's width times its length
return 0
}
func main() {
beds := []Bed{{2, 3}, {4, 5}}
for _, b := range beds {
fmt.Println(b.Area())
}
}
Run tries the examples. When they look right, Submit.