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

  Java program the program has a page that shows the users

java program the program has a page that shows the users name and program name. a second jpanel that shows 4 buttons

  Write a class named test scores

Write a class named TestScores.The class constructor should accept an array of test scores as an argument.The class should have a method that returns the average of the test scores.

  Part iyou have to write a computer program that will figure

part iyou have to write a computer program that will figure out the total of an order when given the amount of the

  Display the earliest and latest dates that appear in a data

display the earliest and latest dates that appear in a data file, and the number of times that they appear. I have already parsed all of the dates from their original string to their corresponding int values.

  Lambert''s vacation rentals

Write an application for Lambert's Vacation Rentals. Use separate ButtonGroups to allow a client to select one of three locations, the number of bedrooms

  We developed a stringlog adt it represents a log that holds

we developed a stringlog adt. it represents a log that holds objects of class string. suppose that instead of

  Your letterinventory class must use an array

Your LetterInventory class must use an array of Counter objects. Note that there is no nextChar method in the Scanner class. You must use the next() method and then use a loop through the characters of the token that is returned. Ignore any character..

  Design a function named "falling distance"

Design a function named "fallingDistance" that accepts an objects falling time, in seconds, as an argument. The function should return the distance, in meters, that the object has fallen during that time interval. Design a program that calls the func..

  Design a class named large integers

Design a class named largeIntegers such that an object of this class can store an integer of any number of digits.

  Develop a program that will handle a golfer and his scores

develop a program that will handle a Golfer and his scores. The program will be comprised of two classes: a Golfer class that will manage all the golfer's scores and a Score class.This is a class designed to represent a golfer including his name, hom..

  Create an array of integers at random

create an array of integers at random with a range of 0 through 1000 in Java... any hints?

  Java application that calculates the body mass index

Write a Java application that calculates and displays the body mass index (BMI) for N people

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