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
: how can you reduce file size so that files can be sent more efficiently across the internet
Rina8888 [55]
You can compress them. ZIP is the most well known protocol.
8 0
3 years ago
Is it possible to code your own game and if so then where should I go to learn and how to publish it?
const2013 [10]

Answer:

Yes there is

Explanation:

It is scratch a coding game to do almost anything you can also code flappybird

Hope this helps.

Have fun with scratch

4 0
2 years ago
Read 2 more answers
What is word processing?
butalik [34]
A. Citing sources for documents you found on the web
3 0
3 years ago
Read 2 more answers
A student has a ten-year-old desktop computer that she only uses for word processing, but she would like to start using it to pl
kondaur [170]

Answer:

1- Replace, 2- Upgrade

Explanation:

I just took the test Hopefully this helps you guys! :)

4 0
3 years ago
What can help you take better animal photographs?
pshichka [43]

Answer:

All of the above

Explanation:

i think i may be wrong.

7 0
3 years ago
Read 2 more answers
Other questions:
  • What does LMS Date Updated mean?
    9·1 answer
  • What are some examples of lighter-than-air vehicles?
    10·1 answer
  • Three uses for Auto Formatting in Word 2016.
    5·1 answer
  • The _____ handles the instructions for your computer to start up before the operating system is loaded.
    10·1 answer
  • Explain what middleware is. Name a common middleware in two-tier client/server architecture for database applications.
    10·1 answer
  • The main purpose of a service panel in a house is to
    11·1 answer
  • In relation to data science,advances in technology has made it more feasible to do what
    5·1 answer
  • Essay about evolution of media shaped the values and norms of the society
    11·1 answer
  • How do you enlarge an image to see more detail on it? (1 point)
    14·2 answers
  • When Alice turned on her laptop this morning, the screen displayed only colorful horizontal lines. Which of the following is mos
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!