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
Vikentia [17]
3 years ago
14

Write a loop that reads strings from standard input where the string is either "land", "air", or "water". The loop terminates wh

en "xxxxx" (five x characters) is read in. Other strings are ignored. After the loop, your code should print out 3 lines: the first consisting of the string "land:" followed by the number of "land" strings read in, the second consisting of the string "air:" followed by the number of "air" strings read in, and the third consisting of the string "water:" followed by the number of "water" strings read in. Each of these should be printed on a separate line. mathew m
Computers and Technology
1 answer:
Setler79 [48]3 years ago
5 0

The loop terminates when "xxxxx" is read in. If the word is land, the string followed by "land" get outputted. The same with air, and water.

Explanation:

int land = 0;

int air = 0;

int water = 0;

String word = "";

while(!(word.equals("xxxxx"))) {

word = stdin.next();

if(word.equals("land")) {

   land++;

}else if(word.equals("air")) {

   air++;

}else if(word.equals("water")) {

   water++;

}  

}

System.out.println("land:" + land);

System.out.println("air:" + air);

System.out.println("water:" + water);

You might be interested in
To break a text string into several lines, which means that the text string continues on the next line, the _____ character shou
Montano1993 [528]

Answer:

To break a text string into several lines, which means that the text string continues on the next line, the backslash character should be used.

4 0
3 years ago
What is a symbol such as a heavy dot or another character that precedes a text in a power point
Fantom [35]

Answer:

<em>I </em><em>think </em><em>the </em><em>answer </em><em>is </em><em>a </em><em>bullet.</em>

<em>Hope </em><em>this </em><em>helps</em>

4 0
1 year ago
Which program will have the output shown below?
Nutka1998 [239]

Answer: Python

Explanation: All I know is that the programming language is Python.

8 0
2 years ago
Read 2 more answers
Read the sentence and answer the question. "Adam Cooper, a cultural strategy officer for the mayor of London, agrees. He thinks
siniylev [52]
<span>I think its pioneers!</span>
8 0
3 years ago
Scott does not use privacy settings on his social media
likoan [24]

Answer:

ARREST HIM!!!

Explanation:

7 0
3 years ago
Read 2 more answers
Other questions:
  • How does the browser display the same webpage whether you enter the URL or the IP address in the address bar? what system transl
    11·1 answer
  • Jenny is going on a trip to wildlife safari with her friends. She wants a camera that will help her shoot fast-moving animals. W
    15·2 answers
  • PLEASE HELP!!!!
    7·1 answer
  • Which format is best for the image below?
    12·1 answer
  • Write a Bare Bones program that takes as input two variables X and Y. (Again, assume these values are set before your program be
    10·2 answers
  • Which shortcut key combination will move the cursor to the beginning of the line?
    13·1 answer
  • Write the correct statements for the above logic and syntax errors in program below.
    12·1 answer
  • Your development team is planning to host a development environment on the cloud. This consists of EC2 and RDS instances. This e
    13·1 answer
  • How is your favorite singer and why I will give Brainliest
    10·2 answers
  • What type of purchase requisition is used to turn-in a recoverable/reparable material to the ssa?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!