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
Create your own Python code examples that demonstrate each of the following. Do not copy examples from the book or any other sou
natulia [17]
Ssfhooiyfbjkoyfvhkodd
6 0
3 years ago
Select the correct answer.
Veronika [31]
I think it’s c. llS....
6 0
3 years ago
Read 2 more answers
This is an example of ______________ of variables:
Sedbober [7]

Answer:

Encapsulation is an example of variables

6 0
2 years ago
A developer working on a time management application wants to make total hours for each timecard available to application users.
Llana [10]

Answer:

The correct option to the following question is A.) .

Explanation:

A Timecard is an application which is used for recording the times the user is working and it is an application for record the time upon logging in to the Web Timesheet, a user punches out and into the mark time they stop and start the works, along with the any comment they choose to enter.

3 0
2 years ago
An individual involved with the aspect of a project will be concerned with budgets and the costs associated with running a busin
Genrish500 [490]
The storming stage of team development is complete when conflicts are resolved and leadership roles are accepted.
6 0
2 years ago
Read 2 more answers
Other questions:
  • Disconnecting or making the equipment safe involves the removal of all energy sources and is known as _____________. A) Isolatio
    8·2 answers
  • How long does it take to wire a house?
    14·2 answers
  • A certain database has numerous tables, but they do not share any fields in common. this database will not be as powerful as oth
    15·2 answers
  • Select the correct answer.
    5·1 answer
  • A security engineer is configuring a wireless network that must support mutual authentication of the wireless client and the aut
    7·1 answer
  • Choose the answer that best completes the
    8·2 answers
  • True or False The two types of general construction projects are residential for homes or dwellings and commercial for a commerc
    7·1 answer
  • Text,Audio and graphic is entered into the computer using
    9·1 answer
  • Elan inserted shapes into a slide in his presentation. What is the quickest way to format those shapes?
    8·1 answer
  • Where is the flash drive listed in a windows 7 save as dialog box?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!