package main

import "fmt"

// Pasuje każdy typ z taką metodą Check
type Checker interface {
	Check() (ok bool, text string)
}

type Space struct{ Percent int }
type Heat struct{ Temp int }

func (s Space) Check() (bool, string) {
	return s.Percent < 90, fmt.Sprintf("zajęte %d%%", s.Percent)
}

func (h Heat) Check() (bool, string) {
	return h.Temp < 50, fmt.Sprintf("%d C", h.Temp)
}

func main() {
	checks := []Checker{Space{75}, Heat{53}, Space{93}}
	for _, c := range checks {
		ok, text := c.Check()
		fmt.Printf("%-5t %s\n", ok, text)
	}
}
