public class Friday { public static void main(String[] args) { int x = 18; int y = 29; // int maximum = Math.max(18, 29); System.out.println("maximum is " + Math.max(18, 29)); // take an age, divide by 2, add 7 // int minAge = 18 / 2 + 7; int minAge = calcMinDatingAge(18); // --> int minAge = 16; System.out.println("the minimum dating age for an 18 year old is : " + minAge); int maxAge = calcMaxDatingAge(18); System.out.println("the maximum dating age for an 18 year old is : " + maxAge); // three parts to writing a method that returns a value: // return statement // change the return type in the header // catch/use the value int minAge2 = calcMinDatingAge(23); System.out.println("the minimum dating age for an 23 year old is : " + minAge2); int maxAge2 = calcMaxDatingAge(23); System.out.println("the maximum dating age for an 23 year old is : " + maxAge2); } public static int calcMinDatingAge(int age) { int minAge = age / 2 + 7; return minAge; } // take the age, subtract 7, multiply by 2 public static int calcMaxDatingAge(int age) { int maxAge = (age - 7) * 2; return maxAge; } }