1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Vera_Pavlovna [14]
3 years ago
14

Given a scanner reference variable named input that has been associated with an input source consisting of a sequence of strings

and two int variables, count and longest, write the code necessary to examine all the strings in the input source and determine how long the longest string (or strings are). that value should be assigned to longest; the number of strings that are of that length should be assigned to count.
Computers and Technology
2 answers:
Makovka662 [10]3 years ago
7 0

The code that examines all the strings in the input source and determines how long the longest string (or strings are) is the following:

total = 0; % initial value is zero, in every while loop it will be incremented

while(input.hasNextInt()){

total += input.nextInt( );

}

BlackZzzverrR [31]3 years ago
5 0

Answer:

int count = 0;  //int variables

int longest =0;  // int variables

Scanner input = new Scanner(System.in); // given input is reference variable

String str= new String();  // creating object of sting class

while (input.hasNext()) // taking the input by using scanner reference

{

str= input.next();  // taking input in string

if (str.length() == longest) // checking condition

++count;  // increment the count

else

if (Str.length() > longest) // if string is greater then longest

{

longest = str.length(); // calculating length

count = 1;  // assign count to 1

}

}

Explanation:

Following are the description of the code :

  • Declared a two variable count and longest of  int type.
  • Create a object of String class i.e 'str".
  • Taking input in the string by using scanner reference i.e "input".
  • Finally checking the condition of if and else block and calculating the length of string and assign into longest variable.
You might be interested in
With the _______ network topology, reliability is the major advantage while high cost is the disadvantage.
WINSTONCH [101]
<span>With the mesh network topology, reliability is the major advantage while high cost is the disadvantage.
Because of its reliability advantage mesh topology is used in backbone networks, because of the redundancy the failure of one node in the network does not result in failure of the entire network. However lot of cabling is required and the cost and maintenance requirements are high. 

</span>
7 0
3 years ago
Write a 2-to-3-page research paper describing in plain language the basic purpose, theory, and implementation of GUI application
laila [671]

Answer:

       

Explanation:

4 0
3 years ago
What is a quick way to determine if a site might contain reliable information? looking at the title of the webpage reading the f
kvasek [131]

The answer is checking the URL.  

Looking at the URL or the web address of the website will help you determine  whether the site contains reliable and credible information or not. Domain names like .edu and .gov are usually trusted sites. What you are looking for are sites with trusted institutions that have a proven record of integrity and reliability. Domain type should always match the content. For example, .edu should have educational material.  By checking the URL, You’ll also be able to establish the person’s name or the agency that published the article.  


8 0
4 years ago
Read 2 more answers
A network on the internet has a subnet mask of 255.255.240.0. what is the maximum number of hosts it can handle
Lera25 [3.4K]
It is a class B network, so for a class B network, the upper 16 bits form the network address and the lower 16 bits are subnet and host fields. Of the lower 16 bits, most significant 4 bits are 1111. This leaves 12 bits for the host number. So, 4096(2^12) host address exists. First and last address are special so the maximum number of address is 4096-2=4094.
7 0
3 years ago
.What is a wildcard character? How would you use it to find a record?
7nadin3 [17]

Answer and Explanation:

A wildcard character is a character that can be substituted for either a single character or a string of characters. For instance, in certain operating systems, the asterisk character "*" can be used in lieu of a set of characters, while the character "?" can be used in lieu of a single character.

It is a special character that represents one or more other characters. The most commonly used wildcard characters are the asterisk (*), which typically represents zero or more characters in a string of characters, and the question mark (?), which typically represents any one character.

For example, in searching: run* would mean "any word that starts with 'run' and has any kind of ending." If you entered "run*" at a search engine that offered a wildcard character capability, you would get results for run, runs, running, runner, runners - in short, any possible word that might begin with the three letters.

Use of wildcard character:

Wildcard characters are utilized in customary articulations (a programming type wherein input information is adjusted depending on indicated designs) and in scanning through record catalogs for comparable document names (for instance, if all the work documents on an undertaking start with the characters "F7," you could undoubtedly find all the venture records by just looking for "F7*").  

It is a special case character and is a sort of Meta character .  

In different card games, a wildcard is an assigned card in the deck of cards.

8 0
3 years ago
Other questions:
  • Write a function: function solution(N); that, given a positive integer N, prints the consecutive numbers from 1 to N, each on a
    14·1 answer
  • Subnetting is accomplished by borrowing bits from the _____ portion of an ip address and reassigning those bits for use as netwo
    13·1 answer
  • Which of the following symbols is used to convert a number to text?
    11·1 answer
  • If you see ##### in a cell, you should
    10·1 answer
  • Which of the following is not a characteristic of a motorcycle?
    6·1 answer
  • With his assembly lines, Henry Ford improved what process? A. computer management B. just-in-time management C. Bessemer process
    5·1 answer
  • Extend to also calculate and output the number of 1 gallon cans needed to paint the wal. Hint: Use a math function to round up t
    12·1 answer
  • Monster Collector
    7·1 answer
  • I cant tell if tubbo is a bee or a goat <br>or could he be human in the smp
    12·1 answer
  • Which data type is used to teach a Machine Learning (ML) algorithm during structured learning?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!