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
One of the most studied computational problems is the ordering of a collection of values. Ordering is important because many pro
andreyandreev [35.5K]

I think the order should be 2-1-3-4, but the description of step 1 is confusing. In selection sort, you iterate from the point of the marker down through the entire list and find the smallest value, and swap that with the value at the marker. Then you advance the marker and repeat the process on the remainder of the list.

7 0
3 years ago
Which of the following would an NSA professional most likely need?
lutik1710 [3]

Answer:

B.a high school diploma and some training

Explanation:

Undoubtedly, NSA professional requires limited education, and a high school diploma is enough for them. However, they will need some training related to security services as well. and only then they will be able to work as an NSA professional. Hence, having only a high school diploma is not enough, and the certificate will also not work. However, they also do not need a bachelor's degree. And they definitely need a high school diploma and some training. That is certainly going to be enough for becoming an NSA professional.

6 0
3 years ago
Read 2 more answers
The following equations estimate the calories burned when exercising (source): Men: Calories = ( (Age x 0.2017) — (Weight x 0.09
sammy [17]

In python:

age = float(input("How old are you? "))

weight = float(input("How much do you weigh? "))

heart_rate = float(input("What's your heart rate? "))

time = float(input("What's the time? "))

print("The calories burned for men is {}, and the calories burned for women is {}.".format(

   ((age * 0.2017) - (weight * 0.09036) + (heart_rate * 0.6309) - 55.0969) * (time / 4.184),

   ((age * 0.074) - (weight * 0.05741) + (heart_rate * 0.4472) - 20.4022) * (time / 4.184)))

This is the program.

When you enter 49 155 148 60, the output is:

The calories burned for men is 489.77724665391963, and the calories burned for women is 580.939531548757.

Round to whatever you desire.

6 0
3 years ago
Help me please. i need you help​
Fudgin [204]

Answer:

Can you provide the code

7 0
3 years ago
It is not necessary to develop strategies to separate good information and bad information on the internet. True or False
Reptile [31]

The answer is False. You should always try to separate the information that could do harm, or isn't true.

6 0
3 years ago
Other questions:
  • Both the USB flash drive and the DVD are data storage devices, but they both have numerous differences. Both can contain insane
    6·1 answer
  • Side mirror using convex mirror or concave mirror?​
    5·2 answers
  • Which of the following options would you use when saving a document with a new filename? *
    12·2 answers
  • What is the best reason to delete Internet browsing history on a regular basis? to solve a computer hardware problem to protect
    13·2 answers
  • A.<br> Post-It note<br> b.<br> notebook<br> c.<br> tutor<br> d.<br> spell check
    14·1 answer
  • Is badlion safe and how ?
    14·1 answer
  • Several NEC® sections contain the requirement to size conductors and overcurrent devices at 100 percent of the noncontinuous loa
    15·1 answer
  • customer seeks to buy a new computer for private use at home. The customer primarily needs the computer to use the Microsoft Pow
    5·1 answer
  • A company has a website that has seen a large increase in visitors and they are concerned that if the trend continues, the web s
    13·1 answer
  • Why is it so important to adhere to principles that have been put forth by reputable organizations to ensure that you are mainta
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!