package quiz.test; import quiz.Son; # # The solution: # Find two different sets of 3 ages where the product of each set equals 36 # The sums of the two sets must be equal # The eldest must not have a twin # rule "determine ages" when Son( $x1: age ) Son( $y1: age < $x1 ) Son( $z1: age <= $y1 ) Son( $x2: age ) Son( $y2: age <= $x2 ) Son( $z2: age <= $y2 ) eval( $x1!=$x2 && $y1!=$y2 && $z1!=$z2 ) eval( ($x1 * $y1 * $z1) == 36 ) eval( ($x2 * $y2 * $z2) == 36 ) eval( ($x1 + $y1 + $z1) == ($x2 + $y2 + $z2) ) then System.out.println( "The ages are eldest: " + $x1 + " middle: " + $y1 + " youngest: " + $z1 ); end