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.

Answers

Answer 1
Answer:

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.
Answer 2
Answer:

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

}


Related Questions

What are the advantages and disadvantages of nuclear energy?
I will brainlistLEAN manufacturing is mostly used in automobilemanufacturing? True or False
An increase in hours of television viewing leads to increases in the sales of snack foods. This is an example of a _____.a. research question b. descriptive hypothesis c. correlational hypothesis d. causal hypothesis
What is an image that you can apply to another image to add detail and texture?
The index used by the OS to manage computer files is called _____.API FAT GUI RAM

If a student is looking for the degree symbol (°) and it is not found on the main drop-down of symbols, what should the student do next?The student should look for a shortcut to that symbol.
The student should click More Symbols.
The student should click Symbols.
The student should find the symbol on the keyboard.

Answers

Answer:

The student should click More Symbols.

Explanation:

The student is currently in the main drop-down of symbols, and yet can't find the desired symbol. The next step would be to go further and look deeper into the symbols drop-down which is done by clicking more symbols.

It is important to note that before the student want to the symbol drop-down, he/she should have already looked through the keyboard for the (°) symbol. It is only natural for troubleshooting for a problem to be progressive. The student goes further to check for (°) by clicking more symbols not going back to looking through the keyboard, looking for a shortcut to the symbol or clicking the symbol icon to bring up the main drop-down for symbols.

Therefore, the only option available is to click More Symbols.

D and A are definitely not the answer. I would say that the answer is B, the student should click More Symbols. 

PowerPoint's varied themes and ____ help give presentations a unified and aesthetically pleasing look. layouts panes tabs slides

Answers

The answer is layout.
In customizing slide elements, varied themes and layouts give the presentations in PowerPoint a unified and aesthetically pleasing look. To give your slides unique quality, you can modify the default theme and layout settings. One of the easier methods in creating a  custom presentation is to change a theme for one or more slides.  

What's the risk or effect of software piracy?

Answers

you can go to jail get in alot of trouble plus you always have a chance of letting a virus into yoru computer
Software piracy carries the following risks:
a) you might pick up a computer virus or other malware from downloading copied software
b) Software developers suffer financial loss because you did not pay for the software you pirated.  This might cause them to lose motivation to develop new software or support their current product(s).

The times per second an audio file is converted from analog to digital is the ______. audio file format bandwidth sample rate waveform

Answers

In audio production, the sample rate is the number of samples, or snapshots, per second taken by a digital audio device. Each audio sample contains data that provides the information necessary to accurately reproduce the original analog waveform. This measurement is expressed in hertz or in thousands of Hertz.


The answer is sample rate :)

Why is it important to install antivirus software for a samba file server in a microsoft windows environment? because linux viruses cause windows operating system clients to become unstable because shared files on the samba server can contain viruses that can infect windows clients to protect the linux server from crashing due to viruses from windows clients to allow automatic updates on linux systems?

Answers

The answer is : Because shared files on the Samba server can contain viruses that can infect Windows clients.  It is important to install antivirus software for a samba file server in a microsoft windows environment because shared files on the samba server can contain viruses that can infect windows clients.  

What term identifies a blank screen or animation that automatically displays on a computer monitor after a specified period of inactivity?a. Control panel
b. Desktop
c. Screen saver
d. Shortcut

Answers

C. Screen saver
Lol i use the bubble ones.