go-by-test/shapes/shapes.go

15 lines
217 B
Go

package shapes
type Rectangle struct {
Width float64
Height float64
}
func (r Rectangle) Perimeter() float64 {
return 2 * (r.Width + r.Height)
}
func (r Rectangle) Area() float64 {
return r.Width * r.Height
}