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
Which statement is true?
Alexeev081 [22]

Answer:

Bjarne Stroustrop published the first reference guide for C++

Explanation:

Bjarne Stroustrop is a computer scientist who created the C++ programming language while working at the AT&T Bell laboratory. He also published the first reference guide for the programming language.

In October 1985, the book, The C++ Programming Language, was published. It describes the c++ programming language and was the only documentation and reference guide for the programming language at the time. Newer editions have since been published.

7 0
3 years ago
Read 2 more answers
What is up what everbody up to
andriy [413]

Answer: Eating chicken. drinking cool aid, and playing basketball

Explanation: look at my skin color and u will understand

5 0
3 years ago
Read 2 more answers
Which logic gate produces an output of 1 only if both it’s inputs are 0?
riadik2000 [5.3K]

Answer:

B, the NOR gate

Explanation:

The truth table of a NOR gate is below.

5 0
3 years ago
1. It is acceptable to use a jack that has been
krok68 [10]
D. None of the above
7 0
3 years ago
The ________ utility automatically creates duplicates of your libraries, desktops, contacts, and favorites to another storage lo
olga55 [171]

Answer:

The correct answer for the given question is option(A) i.e File History.

Explanation:

In computer system file history is an backup application which create backup of your data which are stored in your libraries, desktops, contacts, and favorites to another storage location .It creates back up of your data  to another location when your personal files has been changed.

The user can check the file history option in computer system

open control panel >>system and security >> file system

7 0
3 years ago
Other questions:
  • How do humans feel about being abducted?
    12·2 answers
  • You know a Linux command will perform a desired function for you, but you cannot remember the full name of the command. You do r
    14·1 answer
  • Match the software requirements of a server to their purpose
    5·1 answer
  • 3. What are the first steps that you should take if you are unable to get onto the Internet? (1 point)
    15·1 answer
  • Write a program that sorts a vector of names alphabetically using the selection sort and then searches the vector for a specific
    7·1 answer
  • Which email client feature allows you to store the names and information of people you contact frequently?
    5·1 answer
  • Match the image to the view type in a presentation program. scroll bar tool bar status bar menu bar provides an array of buttons
    10·2 answers
  • The goal of this project is to become familiar with basic Python data processing and file usage. By the end of this project, stu
    8·1 answer
  • When would the Jerusalem virus attack?<br> 1. Friday the 13th<br> 2. Wednesday the 13th
    13·2 answers
  • How do people decide their ethical behavior
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!