Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

Question Complete the code to counts the number of lines input by a user until the user enters the string ENDOFDATA (must be uppercase letters, no spaces) on a line by itself. Make sure you display the number of lines found. Use the nextLine() method of Scanner class to read entire lines of data. (Hint, this is like counting the number of integers entered, but reading Strings and using String comparison to check for equality). String SENTINEL = “ENDOFDATA”; Scanner keyboard = new Scanner(System.in); System.out.println( “Enter lines of data or ” + SENTINEL + ” to quit” );

Question

Complete the code to counts the number of lines input by a user until the user

enters the string ENDOFDATA (must be uppercase letters, no spaces) on a line by itself. Make sure you display the number of lines found. Use the nextLine() method of Scanner class to read entire lines of data. (Hint, this is like counting the number of integers entered, but reading Strings and using String comparison to check for equality).

String SENTINEL = “ENDOFDATA”;

Scanner keyboard = new Scanner(System.in);

System.out.println( “Enter lines of data or ” + SENTINEL + ” to quit” );

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"