Complete the code to counts the number of lines input

Assignment Help JAVA Programming
Reference no: EM13694945

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" );

I cannot seem to get this to work for some reason could somebody provide me a code to compare and test?

Reference no: EM13694945

Questions Cloud

Use m8c assembler directives to allocate : Use M8C assembler directives to allocate the constants in ROM. Assume that they are all in the "lit" area.
Explain the entry of na+ provides a free-energy : Problem- Glucose is pumped into some animal cells by a symporter powered by the simultaneous entry of Na+. The entry of Na+ provides a free-energy input of 10.8kJ/mol under typical cellular conditions
Write an appropriate me expression : Write an appropriate ME expression capturing the essence of each of the following topics:
What product would this situation most likely obtain : What product would this situation most likely obtain. What possible reactions could be run to make it possible to obtain crystals upon crystallization
Complete the code to counts the number of lines input : 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.
Calculate the ph of a buffer hno2 : Problem- Calculate the pH of 1.00 L of a buffer that is 0.120 M HNO2 and 0.150 M NaNO2 before and after the addition of 1.00 ml if 12.0 M HCL(aq)
Explain a sample of gas with an initial volume : Problem- A sample of gas with an initial volume of 33.5L at a pressure of 755mmHg and a temperature of 325K is compressed to a volume of 15.6L and warmed to a temperature of 425K.
Calculate the molar mass that would be obtained data : Problem- Calculate the molar mass that would be obtained from the actul experimental data under the following conditions. The unknown is mehy propy ether (CH3OC3H7) which has the vapor pressure of 375.2 torr at room temperature, 20C.
Full subtractor : Show that a full subtractor can be implemented using a "Full Adder" device and two inverter gates - For this, you will have to create a "Full Adder" device (Note: you can use the idea of what you built in question 2)

Reviews

Write a Review

JAVA Programming Questions & Answers

  Ask user to enter a list of names

Write a program that ask a user to enter a list of names. When you finish, The program will show the total number of characters in all the names.

  Write down a java gui application index2java based on the

write a java gui application index2.java based on the program in step 1 that inputs several lines of text and uses

  Write a recursive method to reverse a string.

write a recursive method to reverse a string. Explain why you would not normally use recursion to solve this problem?

  Implement the fraction class

Implement the Fraction Class, Add the following functions into the definition of the Fraction class above main. The main function already has the calls to those functions written. You must write the required functions into the Fraction class such..

  Create three classes for a customer

a travel manager and have a job of buying a travel package for a customer. You must create three classes for this programming challenge: Customer, Ticket, and TravelManagerDemo.

  Write a java program called salesinfominer

Write a Java program called SalesInfoMiner that reads in a file of products, stored in text format. The program must then read in information about past sales transactions and output all the products to a new file, sorted by product description,..

  Including four sets of quadruplet andsevwn sets of triplets

Mrs. Bernard Scheinberg of Austria had sixty-nine children. Including four sets of quadruplet, sevwn sets of triplets, and sixten of twins. after Mrs. scheinberg died at the age of 56, her husband remarried. during his remaining years, he fathered an..

  Redesign the grading program as an object-oriented design

redesign the grading program as an object-oriented design. We will start with a simple Student class. The student will have a name, an id (as a String) and a set of grades (as doubles)

  Develops algorithms for problem solving

The graduate designs and develops algorithms for problem solving and implements those algorithms using appropriate program code.

  Write an application that uses an array

Write an application that uses an Array to store 10 messages of type String. You will store this Array with 10 messages of your choosing.

  Sorted list adt and the binary search tree adt

Explain the differences between our specifications of the Sorted List ADT and the Binary Search Tree ADT.

  Design and implement a set of classes and interfaces and

design and implement a set of classes and interfaces and use them to evaluate the rtas resource requirements.nbspyour

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd