Home Segments Index Top Previous Next

155: Practice

Write a method that displays one of three comments when sent to a number representing an athlete's resting pulse rate: if the rate is less than 50, the value answered by the method is to be Wow; if the rate is more than 80, the value answered is to be Too High; otherwise, the value answered is to be Ok.

Next, write a method that displays one of three comments when sent to a number representing an athlete's body fat as a percentage of weight: if the athlete's body-fat percentage is less than 10, the value answered is to be Wow; if it is more than 20, the value answered is to be Too High; otherwise, the value answered is to be Ok.