// Homework 21, challenge: Percent. // // Define parsePercent(text string) (int, error). It converts text to an int and // returns that number with a nil error. If the text is not a number, it returns // the error from strconv.Atoi. If the number is below 0 or above 100, it returns // your own error from errors.New. // // Define report(text string), which calls parsePercent, checks the error at // once, and prints the result. Call report with "85", "abc" and "150". // // You will need to add "errors" and "strconv" to the imports. // // Run with: go run exercises/21/homework/04-percent.go package main import "fmt" // TODO: define parsePercent and report here, outside main. func main() { // TODO: make the three calls to report, in place of this placeholder line: fmt.Println("TODO: replace this line") }