// MarilynSolution_8_6.java Copyright (c) 2006 Kari Laitinen // http://www.naturalprogramming.com // 2006-02-15 File created. // 2006-02-15 Last modification. import java.util.* ; class MarilynSolution_8_6 { public static void main( String[] not_in_use ) { Scanner keyboard = new Scanner( System.in ) ; String name_to_be_known = "Marilyn Monroe" ; System.out.print( "\n Who played the main role in the movies:" + "\n\n \"How To Marry a Millionaire\" (1953)" + "\n \"The Seven Year Itch\" (1955)" + "\n \"The Misfits\" (1961) \n\n ? " ) ; String name_from_keyboard = keyboard.nextLine() ; if ( name_to_be_known.contains( name_from_keyboard ) ) { System.out.print( "\n Yes, that is correct.\n" ) ; } else { System.out.print( "\n No, it\'s Marilyn Monroe.\n" ) ; } } } /* The if construct written with the indexOf() method: if ( name_to_be_known.indexOf( name_from_keyboard ) != -1 ) { System.out.print( "\n Yes, that is correct.\n" ) ; } else { System.out.print( "\n No, it\'s Marilyn Monroe.\n" ) ; } ****/