answer.
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
pashok25
1 month 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:
oksian1 [797]1 month ago
5 0

Answer:

for(String s:words)

   if(s.endsWith("ing"))

 System.out.println(s);

Explanation:

Execute an enhanced for loop to go through the words array

Verify if any word in the array ends with "ing" using the endsWith() function (Given that strings are lowercase letters, no additional checks are necessary)

If a word ending with "ing" is found, print it.

You might be interested in
(Java) Which of the following code segments correctly declare a Strings and gives it a value of "fortran".
maria [879]

Response:

IT F

Clarification:

8 0
1 month ago
Which kind of file would be hurt most by lossy compression algorithm
oksian1 [797]

Response: a file containing audio

Clarification:

8 0
10 days ago
Read 2 more answers
Define a method printAll() for class PetData that prints output as follows with inputs "Fluffy", 5, and 4444. Hint: Make use of
ivann1987 [930]

Answer:

public void printAll(){ // member function petAll()

   super.printAll(); //  invokes printAll() method from the superclass (base class) AnimalData using the super keyword

   System.out.print(", ID: " + idNum);} // displays the ID saved in the idNum field of the PetData class

Explanation:

This is the full PetData class:

public class PetData extends AnimalData { //

private int idNum;

public void setID(int petID) {

idNum = petID; }

// FIXME: Implement printAll() member method

/* Your solution goes here */

public void printAll(){

   super.printAll();

   System.out.print(", ID: " + idNum);}  }

The PetData class is a subclass that inherits from the base class AnimalData.

This class contains a private field, idNum, which is designated for storing the ID value.

It includes a method setID which takes petID as a parameter that corresponds to idNum. Essentially, this acts as a mutator to set the user ID.

Additionally, there is a printAll() method that makes use of the super keyword to call the printAll() method from the base class, AnimalData.

Using super refers to objects of the base class.

Here, the super keyword is utilized with the method name from the subclass PetData to avoid confusion, as both AnimalData and PetData have a method named printAll().

During the main() method, users will enter values for userName, UserAge, and UserID. For example, if the user inputs Fluffy as the name, 5 as the age, and 4444 as the userID. Then, calling userPet.printAll(); will execute the printAll() method from the PetData class since userPet is an instance of PetData.

When this method executes, it will call the printAll() of AnimalData class which outputs the Name and Age, while printAll() of PetData prints the ID. Consequently, the resulting output will be:

Name: Fluffy, Age: 5, ID: 4444

8 0
1 month ago
Allows you to manually add an entry to the arp cache that resolves the ip address inetaddr to the physical address etheraddr. wh
Amiraneli [921]
In this situation, when the Adaptor or router gets the destination IP address (even if an incorrect MAC address is entered), it would strip the IP address from the Ethernet frame and using ARP, it will obtain the accurate MAC address of the destination.
6 0
21 day ago
Olivia needs to get permission to use a graph of data gathered by a trade association she plans to include the graph in a report
Natasha_Volkova [897]

She can locate the copyright notice on the webpage that features the graph.

Explanation: ~Apex~

3 0
26 days ago
Read 2 more answers
Other questions:
  • When you add a zero to the right of a decimal number, it multiplies its value by 10 (For example, "15" becomes "150"). What simi
    10·1 answer
  • Which of these is an example of the integrity principle that can ensure your data is accurate and untampered with?
    10·2 answers
  • Describe how the process of sampling, RGB pixels, and binary sequences work together to display a digital color image
    14·1 answer
  • Strlen("seven"); what is the output?
    14·1 answer
  • Here is a super challenge for you if you feel up for it. (You will need to work this out in Excel.) In 2017 the Islamic month of
    11·1 answer
  • More Loops: All versions of foods.py in this section have avoided using for loops when printing to save space. Choose a version
    13·1 answer
  • On the planet Sigma, robots excavate chunks of a very precious cristaline. These chunks can be divided into smaller part only on
    15·1 answer
  • Q2 - Square Everything (0.25 points) Write a function called square_all that takes an input called collection that you assume to
    7·1 answer
  • Leah Jones is the IT manager at Rock Solid Outfitters, a medium-sized supplier of outdoor climbing and camping gear. Steve Allen
    13·1 answer
  • Allison wants to use equations to simplify the process of explaining something to the Sales team, but the default eq
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!