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
Write a program that will compare two names. The program prompts the user to enter two names for a comparison. If the names are
asambeis [7]

Answer:

We can use comparison operator 'Equals to' (==) to compare two strings.

Explanation:

We can use conditional statement 'if else' to put conditions. If statement contains boolean expression.If statement is followed by else block. If the boolean expression evaluates to true, then the if block of code is executed, otherwise else block of code is executed.

If we want to compare two strings with uppercase, then we can convert the input strings given by users using ToUpper() string function.

For example,

 string abc;

string uppercase= abc.ToUpper(); // gives ABC as result

I have written a program using c# as a  programming language in a word document and attached the same. Please find. Thank you!

Download doc
5 0
4 years ago
Which disk drive type contains a magnetic HDD with onboard flash memory serving as a non-volatile cache?
Shkiper50 [21]

Answer:

SSHD - Solid State Hybrid Drives

Explanation:

SSHD - Solid State Hybrid Drives -

Hard disk refers to a storage form of device , which uses uses the combination of the fast storage medium like the solid - state drive along with the very higher - capacity hard disk drive .

In the solid state hybrid drives , the combination of the onboard flash memory and the magnetic HDD , which is less expensive than the SSD.

Hence , from the given information of the question ,

The correct term is SSHD - Solid State Hybrid Drives  .

5 0
3 years ago
2) A language that changes code to machine-readable code one command at a time is known as what
iogann1982 [59]

Answer:

2) Interpreted programming languages (e.g. Python, Perl)

3) In computer science, the syntax of a computer language is the set of rules that defines the combinations of symbols that are considered to be correctly structured statements or expressions in that language. That means that the each programing language has its own specific rules.

4) Pseudocode

5) Cryptographic coding, examples: The Caesar shift, Kryptos

5 0
3 years ago
6. kinukuha nito ang kabuuang bilang ng mga numerical na datos sa mga piniling cells
horrorfan [7]

Answer:

1.  Sum Function

2. Average Function

3. Max Function

4. Min Function

5. Count Function

Explanation:

4 0
3 years ago
I need help with this please and thanks
yuradex [85]

WHOA, ok thats ALOT but i can tell you that 9 is C.

3 0
3 years ago
Other questions:
  • In addition to talking to other doctors remotely, telegraphy technology?
    5·1 answer
  • The web server software used has a significant impact on how a web site's web pages look on a user's computer.
    7·1 answer
  • a) Before writing any code, you should go through a design process. Try to do so carefully – either follow a top-down approach,
    15·1 answer
  • is there anybody out there who is a social butterfly like me? If so then you can tlk to me on this. and to anybody out there tha
    12·1 answer
  • when you enter a formula in a cell the result of the calculation displays in a cell. how do views of formula after entering it?
    9·2 answers
  • Help meee pleaseeee
    5·1 answer
  • Help teacher said with complete explanation ​
    5·1 answer
  • Irene is creating a wireframe of a website she is working on to show her client. In which phase of the development process is sh
    13·1 answer
  • Jared is a corporate trainer who creates presentations to deliver at workshops. When creating these
    8·1 answer
  • The firewall protects a computer or network from network-based attacks along with _____________ of data packets traversing the n
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!