// Short program demonstrating examples of using return values // Shows using the return values from methods in the Math class // and using return values returned from methods in this class public class Fri { public static void main(String[] args) { double power = Math.pow(2, 7); System.out.println("power = " + power); System.out.println("root = " + Math.sqrt(121)); System.out.println(); int age = 21; // int resultAge; // calcMinDatingAge(age); int resultAge = calcMinDatingAge(age); System.out.println("min dating age for " + age + ": " + resultAge); System.out.println("min dating age for 67: " + calcMinDatingAge(67)); System.out.println("min dating age for 24: " + calcMinDatingAge(24)); System.out.println("min dating age for 95: " + calcMinDatingAge(95)); System.out.println(); resultAge = calcMaxDatingAge(age); System.out.println("max dating age for " + age + ": " + resultAge); } // returns the minimum dating age given an age based on the societal // convention of (age / 2) + 7 public static int calcMinDatingAge(int age) { int resultAge = age / 2 + 7; return resultAge; } // returns the maximum dating age given an age based on the societal // convention of minumum dating age being (age / 2) + 7 public static int calcMaxDatingAge(int age) { return (age - 7) * 2; } }