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]
2 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]2 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]2 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
The 8-bit ____ field is used by source network hosts and forwarding routers to distinguished classes or priorities in ipv6 packe
noname [10]
It is the 8-bit priority field hopes it helps

7 0
2 years ago
Write a for loop with a range function that prints the following output. Name the target variable number. 0 1 2 3 4 5
Aloiza [94]

Answer:

The program in Python is as follows:

for number in range(6):

    print(number, end=' ')

Explanation:

From the program, the range is 0 to 5.

The following line iterates from 0 to 5 using "number" as its iterating variable

for number in range(6):

This prints each number in the range followed by a blank space

    print(number, end=' ')

4 0
2 years ago
Which button will allow you to insert quotes and notes into text into a document​
oksano4ka [1.4K]

Answer:

You copy and paste it

Explanation:

right click on the mouse then it will say copy, you right click on the mouse and click paste voila! it works! (If you're using word there are 3 options for pasting, Keep source formatting, Merge formatting and keep text only)

8 0
3 years ago
9.2 lesson practice ​
makvit [3.9K]

Answer:

6 columns/items

Explanation:

<em>grid</em> starts off as an empty list ( [ ] ), so right now it has 0 items/columns.

After that, 3 new items ("frog", "cat", "hedgehog") have been appended to <em>grid</em>, it now has 3 items

Finally another 3 items are appended to <em>grid ("fish", "emu", "rooster"</em>), finally <em>grid</em> ends up with 6 items in total.

5 0
2 years ago
A hard disk has four surfaces (that's top and bottom of two platters). Each track has 2,048 sectors and there are 131,072 (217)
marysya [2.9K]

Answer:

128 GB

Explanation:

Here, we are interested in calculating the total capacity of the disk.

From the question, we can identify the following;

Number of surfaces = 4

Tracks per surface = 131,072

Number of sectors = 2,048

Each Block size = 512 bytes

Mathematically;

Total data capacity of the disk = no of tracks * no of sectors * block size

= 131,072 * 2048 * 512 bytes

= 2^17 * 2^11 * 2^9 bytes = 2^37 bytes

1 GB = 2^30 bytes

So 2^37 = 2^7 * 2^30

= 128 GB

8 0
2 years ago
Other questions:
  • The ____ function sums the numbers in the specified range and then divides the sum by the number of cells with numeric values in
    14·1 answer
  • Help PLEASE (in attachment)
    8·1 answer
  • What is the name for the size and style of text?
    8·2 answers
  • In confirmatory visualization Group of answer choices Users expect to see a certain pattern in the data Users confirm the qualit
    9·1 answer
  • D State Six Impact of ICT the society​
    7·1 answer
  • 9. Themes can be modified using variants. *<br><br>True<br>False​
    7·2 answers
  • ProgrammingAssignment3
    8·1 answer
  • Output each floating-point value with two digits after the decimal point, which can be achieved by executing cout &lt;&lt; fixed
    7·1 answer
  • How does digital and hybrid computers differ in portability​
    9·1 answer
  • Checking for and correcting errors may need to be done numerous during which of the following phases of the software development
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!