JAVA

Write a method that takes 2 parameters: an ArrayList list, and an int numRepeats representing the number of times to repeat each element in the array.


Return a new ArrayList with each element repeated numRepeats times.


For example, if we had an ArrayList list with the values ["hello", "world"]:


repeatElements(list, 3)

Should return a new ArrayList with the elements:


["hello", "hello", "hello", "world", "world", "world"]


public ArrayList repeatElements(ArrayList list, int numRepeats)

{


}

Answers

Answer 1

Answer:

Explanation:

The following Java code creates the repeatElements method as requested and uses the test case shown in the question to test the method. The output can be seen in the attached picture below.

import java.util.ArrayList;

class Brainly {

   public static void main(String[] args) {

       ArrayList list = new ArrayList();

       list.add("Hello");

       list.add("World");

       System.out.println(repeatElements(list, 3));

   }

   public static ArrayList repeatElements(ArrayList list, int numRepeats) {

       ArrayList newList = new ArrayList();

       for (Object x:list) {

           for (int i = 0; i < numRepeats; i++) {

               newList.add(x);

           }

       }  

       return newList;

   }

}

JAVAWrite A Method That Takes 2 Parameters: An ArrayList List, And An Int NumRepeats Representing The

Related Questions

PLEASE HELP !!!!!!!!!!!!!
What is revising?

Answers

Answer:

Revision literally means to “see again,” to look at something from a fresh, critical perspective. It is an ongoing process of rethinking the paper: reconsidering your arguments, reviewing your evidence, refining your purpose, reorganizing your presentation, reviving stale prose.

What can be written to perform a certain number of iterations or to iterate until a specific result is achieved?

Answers

so in coding we use a thing called a loop to one of the most common loops is a if or loop this is when we tell the software to keep trying the task that is in the loop until it completes the task.

-scav

Can you use 2 wireless keyboards and 2 wireless mouse on a dual monitor desktop without interfering with the other monitor ?

Answers

Answer:

I'm pretty sure this is not possible on Windows OS.

Explanation:

Two different monitors can work, as you probably know, but I don't think you can use separate keyboards and mice on the same machine.

always follow the routine "clean up while in use and clean up before keeping it".

true or false​

Answers

This answer out of the true or false or true

Mecanismo que permite conocer si la persona que esta ingresando a un sistema es realmente quien deba y no un intruso

Answers

Answer:

Sistemas de autenticación y seguridad de la información.

Explicación:

La seguridad de la información es un mecanismo que permite saber si la persona que está ingresando a un sistema es realmente quien debería y no un intruso. La seguridad de la información básicamente ayuda a prevenir el acceso no autorizado y permite que la única persona autorizada ingrese al sistema. Los sistemas de autenticación son el mecanismo de seguridad que se utiliza para proteger los datos y los sistemas. Estos sistemas de autenticación también ayudan a garantizar que los usuarios sean la persona autorizada o no.

What is a network?
A. The software only that connects electronic devices so they can
communicate with each other

B. The hardware only that connects electronic devices so they can
communicate with each other

C. The hardware and software that prevents electronic devices from
communicating with each other

D. The hardware and software connecting electronic devices so they
can communicate with each other

Answers

Answer:  For a network to exist, both the hardware and software of a computer must be able to communicate with other computers, so the answer is D.

The hardware and software connecting electronic devices so they can communicate with each other.

What is Network?

An interconnected system of nodes that can send, receive, and exchange data, voice, and video traffic is known as a computer network, sometimes known as a data network. Servers or modems are two examples of nodes in a network. Endpoint users frequently use computer networks to exchange resources and communicate.

They frequently appear everywhere, including in buildings like homes, offices, and government agencies. Computer networks can be used to share information and get around geographical restrictions.

Several protocols and algorithms are used by network devices to define the precise transmission and reception of data by endpoints. For instance.

Therefore, The hardware and software connecting electronic devices so they can communicate with each other.

To learn more about Network, refer to the link:

https://brainly.com/question/15002514

#SPJ7

A laptop has an Nvme drive (C:) and a mechanical hard drive (D:), when the user notice that the D: drive is not there.
what should the technician do to see if the drive is recognized by the OS?

Answers

Answer:

Explanation:

The user should type in the search bar at the bottom right of the taskbar the following keywords, Create and format hard disk partitions and click on the option that appears with the same name. This will open Disk Management which will give information on all of the different storage options that the computer has installed. If the OS is detecting and recognizing the drive it will appear here. Many times the drive does not appear because it does not have a drive letter assigned to it. This can be assigned to the drive from the Disk Management.

A security hole is a(n): Group of answer choices packet-level firewall small peep-hole in a door or wall to allow a security guard to examine an individual before allowing that individual access to a secure area or location malfunction or bug in an application program that allows data to be seen or accessed by unauthorized users missing or absent protected mode addressing restrictions on user programs during multitasking or multithreaded program execution ANI system

Answers

Answer: malfunction or bug in an application program that allows data to be seen or accessed by unauthorized users.

Explanation:

A security hole is the malfunction or bug in an application program that allows data to be seen or accessed by unauthorized users.

A security hole is regarded as a software flaw that allows someone who isn't authorized to have access to the system. This vulnerability can be taken advantage of by a hacker or other threat factors.

The Quick Access Toolbar is typically
located in the top-right corner of the
window, above the ribbon.
True
False

Answers

Answer:

False

Explanation:

It is on the left

it is false hey a so it’s a

Harrison works in a manufacturing unit and oversees the logistics, including the daily shipping of a large number of packages. Which information system will he use in the unit to keep track of the deliveries?

Answers

Answer:

E. Transaction processing system

Explanation:

Explanation: He will need a transaction processing system to know the amount of logistics available daily and how many to ship and how many to order. Transaction processing system will make him keep track of what transactions take place during the various days to help him give a good report.

why should information technology NOT be taught in school?​

Answers

Explanation:

Technology should not be used to teach in school as it can lead to distractions. With kids wanting to explore other sights, cheating, and communicating with others. Also, it can be expensive to purchase the technology for everyone as it can be a major investment with hundreds or thousands going into it. Technology also requires a lot of training by having to adapt lessons compatible with the systems and making sure the software is secure.

A DTP firm has published and printed fliers for an upcoming fundraising event. In which section of the flyer would you find the contact details of the DTP firm
A. Body
B. Credits
C. Navigation
D. Title

Answers

B.Credits at the end of the flyer

Three types of common program errors are syntax, runtime, and logic. (5 points)
O True
O False

Answers

Answer:

True

Explanation:

True,My good sir/maam

hi please help ASAP it's about html!​

Answers

Given :-

Create a HTML code for writing a web page for your school time-table.

Answer :-

<html>

<head>

<title> Time Table </title>

</head>

<hrcolor = "red">

<hrcolor = "blue">

<body>

<table><tr = "7"><md = "7"><Period 1_></table>

</body>

</html>

[tex] \\ [/tex]

Answered by - ItzMaster

Match each operating system drawback to its respective operating system.

1. more susceptible to viruses Linux. Operating System
2. fewer compatible applications Microsoft Windows Operating System
3. limited support system Apple Operating System

Answers

Answer:

Microsoft Windows - More susceptible to viruses

Linux - Limited support system

Apple - Fewer compatible applications

Explanation:

Generally windows is more susceptible to viruses.

Linux is open source meaning it's up to the community to help you.

Apple has been supporting more applications in these coming years but it still lacks the wide range of apps windows supports.

Answer:

1. Microsoft Windows is more susceptible to viruses

2. Mac OS X (Apple OS) has fewer compatible applications

3. Linux OS has a limited support system.

the main work area of the computer is the

Answers

Answer:

Desktop

Explanation:

The desktop is the main work area of your computer, and will likely be the most visited area of your computer. Your desktop appears every time you log into your account, and contains icons and shortcuts to your most used programs and files.

_______________is the career cluster that medical professionals are under.

Answers

I think the answer is Doctor ?

Sasha has just gotten a new job in a nearby city. After
comparison shopping, she found that renting a nice two-
bedroom apartment would cost around $800 per month.
Her utilities would cost about $150 per month.
Sasha has enough money saved for a down payment, and
she found that she can buy a three-bedroom house or
condo with a mortgage payment of $1,000 per month,
including taxes and homeowner's insurance. Her utilities
would cost about $200 per month.
Sasha's new.company has told her that she will be
required to move at her own expense in two years.
What should she consider before making her decision?
The monthly costs of renting and buying
The extra expenses needed for maintenance while
she lives in the house.
The amount of the down payment she will need to
make
The expense of selling the home when she leaves
the city

Answers

where is the question??

Explanation:

Write down a scratch program which:
performs the following tasks 5 times:
1. asks the user to input numbers
2. add the numbers in total variable
3. outputs the result

Answers

What computer language?

write any two reasons why files are stored in folders​

Answers

Answer:

Explanation:

The answer is The tree structure suggests the main benefit of folders: to organize your files. You can create folders to store and organize your pictures, your documents, your videos, and so on. Folders are also used to separate the files created by different users.

Answer:

Putting files into folders can help you stay organized and keep your files seperated. Having seperate place for different files make them easy to find. Having folders for your files also make them easier to move, for example, if you are moving your information to a new device, it is faster and more efficient because your files are placed in folders, so you don't have to move each indviual file.

I hope this was helpful! =)


what is the answer???​

Answers

Answer:

I think it should be C

Explanation:

A group of two or more computers that are link together.

also have a good day people !!

Answers

Answer:

Thx u2!!

Explanation:

Everyone have a good day!

Answer:

You too and thank you for 50 points!!

Explanation:

PLEASE HELP WILL GIVE BRAINLIEST

Answers

Answer:

Explanation: answer is b) the row comes first  in the  element of an index

Kevin created a scene in an animation where he shows a leaf falling slowly. Which principle of animation did he follow in doing so? Kevin is using the principle of ____. This principle is proportional to the _____ of the objects displayed. Answers given for the first: Arcs, Timing, Staging Answers given for the second: Height, Length, Speed

Answers

Answer:

Kevin is using the principle of Timing. This principle is proportional to the Speed of the objects displayed.

Explanation:

Timing is one of the principles of animation wherein the speed of the movement of an object is controlled by the animator and made to harmonize with certain effects such as sounds. In an example of some projected balls we find that when getting to the peak, their movement is slower compared to when they are coming down.

Speed plays a key role here. This is similar to the slowly falling leaf. Speed and timing are major considerations. When paired with good sounds, the animation comes off better.

In python please!! Write the definition of a function named countPos that needs integer values from standard input until there are none left and returns the number that are positive. The function must not use a loop of any kind.

Answers

Answer:

Explanation:

The following code is written in Python it doesn't use any loops, instead it uses a recursive function in order to continue asking the user for the inputs and count the number of positive values. If anything other than a number is passed it automatically ends the program.

def countPos(number=input("Enter number: "), counter=0):

   try:

       number = int(number)

       if number > 0:

           counter += 1

           newNumber = input("Enter number: ")

           return countPos(newNumber, counter)

       else:

           newNumber = input("Enter number: ")

           return countPos(newNumber, counter)

   except:

       print(counter)

       print("Program Finished")

countPos()

What is the dark, sticky substance that forms when tobacco is burned?

Answers

Answer: Tar.

Explanation:

A chemical substance made when tobacco is burned. Tar contains most of the cancer-causing and other harmful chemicals found in tobacco smoke. When tobacco smoke is inhaled, the tar can form a sticky layer on the inside of the lungs.

A man-in-the-middle attack or impersonation are likely to result in problems with

data availability.

data confidentiality.

data integrity.

data mining.

Answers

Answer:

Data Confidentiality

Explanation:

A Man-In-The-Middle-Attack (MITM) is an attack when a hacker gets between a communicative situation and digitally eavesdrops.

A man-in-the-middle attack or impersonation is likely to result in problems with data confidentiality. Thus, option B is correct.

What is a  man-in-the-middle attack?

A man-in-the-middle (MITM) attack is a broad name used whenever an abuser inserts himself into a conversation between a user and now an application. That will listen in on the conversation or to pretend to be one of the participants and create the impression that normal information-sharing is taking place.

Attacks compromise the integrity and confidentiality of exchanges, which exposes information, technology, and other things to malevolent use. Consider the threat if a hacker was able to remotely open an automatic door lock or deploy the airbags in a linked car.

Therefore, option B is the correct option.

Learn more about man-in-the-middle attack, here:

https://brainly.com/question/13014110

#SPJ6

Hardware refers to programs and protocols used on a computer system.

True
False

Answers

Answer:

False

Explanation:

Answer:

false

Explanation:

i JUST took the quiz

Which ribbon tab has the tool that lets you connect your text to a URL?
Home
Insert
Review
Animations

Answers

Answer: Insert

Explanation:

The Ribbon was introduced by Microsoft in 2017 and it's simply a user interface element that can be found below Quick Access Toolbar. The Ribbon consist of seven tabs which are:

• Home

• Insert

• Page layout

• References

• Mailing

• Review

• View.

The Ribbon tab that has the tool that lets you connect your text to a URL is the Insert tab.

In the Menu bar, the person should click on the Insert tab that us in the Links section. After that, click on the Hyperlink or the Link option, then in the Insert Hyperlink window, one can then type addr as of the web page that the person wants to connect the text to after which the leoen will then click OK.

Drag the tiles to the correct boxes to compete the pairs. Identify the types of chemical reactions occurring in the chemical equations.

Answers

The question is incomplete. The complete question is :

Drag the tiles to the correct boxes to compete the pairs. Identify the types of chemical reactions occurring in the chemical equations.

combustion reaction , photosynthesis , respiration

water + carbon dioxide + sunlight → oxygen + glucose

methane + oxygen → water + carbon dioxide + heat

glucose + oxygen → carbon dioxide + water + energy

Solution :

The chemical reactions that is occurring in the following chemical equations are :

Photosynthesis

water + carbon dioxide + sunlight → oxygen + glucose

Plants uses the light energy from the sun in the presence of water and carbon dioxide produces food by the process of photosynthesis. It produces glucose and oxygen.

Respiration

glucose + oxygen → carbon dioxide + water + energy

The cellular respiration process produces ATP with the breakdown of the glucose and oxygen. During respiration process, carbon dioxide is obtained along with water and energy.

Combustion reaction

methane + oxygen → water + carbon dioxide + heat

Combustion reaction is a chemical reaction in which methane is the main ingredient. Combustion takes place as things burn in the presence to methane and oxygen to form carbon dioxide, water and heat.

Other Questions
How could the writer improve the underlined sentence to remove the logical fallacy?A. Everyone who appreciates our countrys oldest buildings should forget the architectural philosophy out with the old, in with the new.B. Anyone who accepts the out with the old, in with the new architectural philosophy is a menace to society.C. Some people have embraced the out with the old, in with the new philosophy, as the number of applications for demolition permits hit a record high this year.D. The out with the old, in with the new approach to architecture is clearly a result of people who no longer care about our countrys oldest buildings. Assume that the heights of men are normally distributed with a mean of "71.3" inches and a standard deviation of 2.1 inches. If 36 men are randomly selected, find the probability that they have a mean height greater than 72.3 inches. Round to four decimal places. i almost never do this so i will give 100 points to someone who can help me with this!Other than self-defense, do you believe there are any circumstances in which it is justified for a nation like the United States to use force against another nation?Answer in a paragraph. when was athens founded HELP ASAP PLSS!!The following excerpt relates to which amendment of the Bill of Rights?Fourth AmendmentSeventh AmendmentFirst AmendmentTenth Amendment Which region of the US was based on mining? HELP PLEASEWhat questions do they ask on Spanish 2 Module 2 DBA For the following five (5) questions, fill in the blank with the appropriate possessiveadjective.1.(ella) hermanasonotumissussu Predict what would happen if the same experiment was conducted with different amounts of water. HELP. This is due in a bit. Giving Brainliest!! Evaluate this expression. 32 + (72.1) please answer chad randomly chooses a card from a standard deck 30 times. what is the probability he gets a diamond exactly 4 times what does primary mean as it's used in the sentence today the X-ray is still the primary to as a doctor use to find a broken bone in their health problems A.safest B.latestC.most used 7th grade English! Please help!In a true/false question, every part of the statement must be true for the answer to be true.A TrueB False A train arrives at the station with 150 passengers on board. 2/5 of the passengers get off the train in seattle , and then 35 passengers board the train . How many passengers are on the train when it leaves the station? Honey Bell Corporation has the following information about its Eclipse Product: Honey Bell Corporation Eclipse Product Expected Sales 10,000 units Direct material and labor costs $ 150 per unit Variable manufacturing overhead $ 20 per unit Fixed manufacturing overhead $ 300,000 Fixed selling and administrative expenses $ 150,000 Average operating assets $ 2,000,000 Required return on investment 20 % What is the amount of the markup percentage on the absorption cost that should be used to derive the selling price of this product PLEASE HELP....DONT USE BITLY LINKThis is a blueprint drawing of the stage area at Millennium Park. The length of one square on the grid is equal to 5 feet. According to the blueprint, the length of the diagonal of square C is 60 feet. Is that correct? Explain. Read the second line of the story:They were trying, again, to rig up their garbage containers to prevent the neighborhood black bears from making a mess.What is the main function of this text in the narrative? Pollution has a severe impact upon nativeanimal populations.Logos ethos pathos Select the correct answer.Which graph shows the correct relationship between kinetic energy and speed?