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
natulia [17]
3 years ago
11

array of String objects, words, has been properly declared and initialized. Each element of words contains a String consisting o

f lowercase letters (a–z). Write a code segment that uses an enhanced for loop to print all elements of words that end with "ing". As an example, if words contains {"ten", "fading", "post", "card", "thunder", "hinge", "trailing", "batting"}, then the following output should be produced by the code segment.
Computers and Technology
1 answer:
Vlad [161]3 years ago
5 0

Answer:

for(String s:words)

   if(s.endsWith("ing"))

 System.out.println(s);

Explanation:

Create an enhanced for loop that iterates through the words array

Check if an element in words ends with "ing" using endsWith() method (Since it is said that strings are lowercase letters, we do not need to check it)

If you find one that ends with "ing", print the element

You might be interested in
Petra has an interview with an IT company. What technique can help prepare her?
SVEN [57.7K]
I would go C because that way it gets her prepared to answer any techie questions they would have for her and would make her a better option.
3 0
3 years ago
Read 2 more answers
(1) Prompt the user for a string that contains two strings separated by a comma. (1 pt) Examples of strings that can be accepted
denis-greek [22]

Answer:

Check the explanation

Explanation:

#include <stdio.h>

#include <string.h>

#include <stdlib.h>

#define MAX_LIMIT 50

int checkComma(char *input)

{

int flag = 0;

for(int i = 0; i < strlen(input); i++)

{

if(input[i] == ',')

{

flag = 1;

break;

}

}

return flag;

}

int main(void)

{

char input[MAX_LIMIT];

char *words[2];

char delim[] = ", ";

printf("\n");

do

{

printf("Enter input string: ");

fgets(input, MAX_LIMIT, stdin);

size_t ln = strlen(input) - 1;

if (*input && input[ln] == '\n')

input[ln] = '\0';

if(strcmp(input, "q") == 0)

{

printf("Thank you...Exiting\n\n");

exit(1);

}

else

{

if(checkComma(input) == 0)

{

printf("No comma in string.\n\n");

}

else

{

char *ptr = strtok(input, delim);

int count = 0;

while(ptr != NULL)

{

words[count++] = ptr;

ptr = strtok(NULL, delim);

}

printf("First word: %s\n", words[0]);

printf("Second word: %s\n\n", words[1]);

}

}

}while(strcmp(input, "q") != 0);

return 0;

}

Kindly check the attached image below for the output.

4 0
3 years ago
When was the idea of the cloud first developed?<br><br> 2000s<br> 1990s<br> 1960s<br> 1980s
kondaur [170]

Answer:I would say 1980 is the answer or The answer is B 1980.

5 0
3 years ago
The laws governing search and seizure in the public sector are much more straightforward than those in the private sector. TRUE
Lapatulllka [165]

Answer:

True

Explanation:

Because of the contract that you have agreed to when joining the work force. Which is different from the private sector.

7 0
3 years ago
In everyday life, we use numbers based on a combination of digits between 0 and 9.
serious [3.7K]

Answer:

denary is the answer thank you

3 0
3 years ago
Other questions:
  • Operating systems are designed to work with specific hardware. Which operating system works with Apple computers?
    8·2 answers
  • What is the order in which windows systems receiving and process multiple gpos?
    7·1 answer
  • _____ is when a person connects their location to photos that are posted online.
    5·2 answers
  • Which type of image is not a supported using the Online Pictures or Insert Picture command?
    5·2 answers
  • Raid level 6 is basically the same as RAID level 5, but it adds a second set of parity bits for added fault tolerance and allows
    7·1 answer
  • Select the correct answer.
    6·1 answer
  • Technician A says that temperature sensors decrease in resistance as the temperature​ increases; this is called positive tempera
    12·1 answer
  • At each layer of the OSI model, data is appended to the original message and then sent on to the next lower layer. What is this
    10·1 answer
  • How do design elements and color work together on a web page?
    15·1 answer
  • WILL GIVE A BRAINLIEST!!! PLS HELP!!!
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!