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
When you save a Notepad file for the first time, you must also A. print a copy for your records. B. give it a name. C. check the
Kruka [31]
Answer: Give it a name
3 0
3 years ago
When writing HTML code, what is meant by 'syntax'?​
aleksandrvk [35]

Answer:

   Syntax is essentially the punctuation and grammar rules for a computer language.

Explanation:

  Certain characters and words have special meanings and must appear in a particular order for the computer code to make any sense. A simple example from line 3 in Figure 2.2 is the piece of HTML code <head>.

8 0
3 years ago
What is a wireless network that provides communication over a short distance that is intended for use with devices that are owne
andrew11 [14]

Answer: personal area network

Explanation:

it can connect personal devices to make network, the personal network are phone,laptop,printer and soon in order to communicate.

3 0
3 years ago
Read 2 more answers
Uso de las redes sociales como el uso de una impresora en casa se satisfacen estás tres etapas
Svetradugi [14.3K]

Question: what question is this?

7 0
2 years ago
Is space between lines of program code that makes the code easier to read and that the compiler ignores?
MAXImum [283]
<span>The space between the lines of program codes make the code easier to read.  This is used by programmers to make their programs more readable and clear.  The space between the lines is not recognized by the compiler, thus it is ignored by the compiler.</span>
3 0
3 years ago
Other questions:
  • _____ is a function performed by control programs that manages computer resources, such as storage and memory.
    11·1 answer
  • You have been contracted by a local school to evaluate their computer labs for security threats. They are most worried about the
    6·1 answer
  • Differentiate among a color display, gray scale display, and a black-and-white display​
    7·1 answer
  • What takes information entered into a given system and sends it automatically to all upstream systems and processes?
    6·2 answers
  • Dallas is an analyst at an online retailer. He is great at creating representative diagrams showing the relationships between cu
    12·1 answer
  • What is a spreadsheet program?<br> A spreadsheet program is a computerized version of _______
    5·1 answer
  • This finding maximum number function will keep on going until we reach at the last value
    12·1 answer
  • The best presentations try to include as much text as possible on each slide true or false ​
    13·1 answer
  • Write a Boolean expression that tests if the value stored in the variable num1 is equal to the value stored in the variable num2
    10·1 answer
  • During the maintenance phase of the sdlc, the team must _____ if a system's objectives are not being met
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!