Complete the getOdds method so it returns a new ArrayList of Integers containing all odd Integers from the parameter ArrayList vals in the order they originally appeared. The contents of vals should not change. For example if an ArrayList containing the Integers 2, 5, 8, 6, 7, 3, 12 in that order is passed as a parameter to getOdds, it should return an ArrayList containing the Integers 5, 7, 3 in that order. Write your getOdds method in the U7_L2_Activity_Three class. Use the runner class to test your method but do not add a main method to your U7_L2_Activity_Three.java file or your code will not be scored correctly.

Answers

Answer 1

Answer:

Answered below

Explanation:

//Program is written in Java programming language.

public ArrayList<Integer> getOdds( ArrayList<Integer> list){

// Create variables to hold the new list and the //indexes.

int i;

ArrayList<Integer> oddList = new ArrayList<Integer>()

//Loop over the list and add every odd element // to the new list

for ( i = 0; i < list.length; I++){

if ( list[i] % 2 != 0){

oddsList.add(list[i])

}

}

return oddList;

}


Related Questions

Is a free verse a poetry that has no images

Answers

No it just means that it does not have any specific rhymes or formats
No they just typically have no set meter

Brian has created the following selection sort class in Java. In which line is the index of the smallest value returned? In which line is the input array given as an argument?

public class SelectionSort{
private static int positionMin (int] vals, int startPosition) {
int minPosition startPosition;
for (int i startPosition; i
if (vals[i] vals[min Position]) {

minPosition = i;
return min

Position; private static void swap(int] vals, int firstPosition, int secondPosition) {

int temp; temp vals[firstPosition];
vals[firstPosition] vals[second Position];
vals[secondPosition] temp return public static void selSort(int| vals) {
int minPos for (int startPos 0; startPos< vals.length; startPos++){

minPos positionMin(vals,startPos); swap(vals,startPos, min Pos) ;

for (int i 0; i< vals.length; i++) { if(i
}else Jelse { System.out.println(vals[i]); } }; }

return; } }

Answers

Answer:

Explanation:

Since there are no line numbers in this question I will start counting from public class SelectionSort{ as line 1 and so on, as well as provide the code on that line.

The index of the smallest value is returned on line 8 where it says return min which shouldn't have any spaces and should be return minPosition;

The input array is given as an argument at the beginning of the function on line 2 where it says private static int positionMin (int] vals, int startPosition) {, as the variable vals.

This input array is also used as an argument on line 10 where it says Position; private static void swap(int] vals, int firstPosition, int secondPosition) and line 15 where it says vals[secondPosition] temp return public static void selSort(int| vals) {

The programming interface for a legacy motor controller accepts commands as binary strings of variable lengths.

a. True
b. False

Answers

Answer:

The answer is "Option a"

Explanation:

The given question is incomplete, that's why its correct solution can be defined as follows:

The above-given question is the part of the Binary Autocomplete, in which this Autocomplete function would be a full word or sentence after just a few other letters were entered into the system. It approach improves text taking appropriate on smartphone devices of particular because every letter should not be written in such a single phrase.  

What are the top ten famous games in the U.S.

Why? cause I wanna know :D

Answers

Minecraft

Fortnite

Rob.lox

GTA V

Rocket league

League of legends

Mario bros

GTA

Among us

Call Of Duty

Choose the type of collection created with each assignment statement

____ collection A = {5:2}
Options: tuple, dictionary, list

____ collection B = (5,2)
Options: tuple, dictionary, list

____ collection C = [5,2]
Options: tuple, dictionary, list

Answers

Answer:

dictionary

tuple

list

Explanation:

Define a class named person that contains two instance variables of type string that stores the first name and last name of a person and appropriate accessor and mutator methods. Also create a method named displayDetails that outputs the details of a person

Answers

Answer:

Answered below

Explanation:

//Program is written using Java programming language.

Class Person {

private string firstName;

private string lastName;

void set firstName(string a){

firstName = a;

}

string getFirstName(){

return firstName;

}

void setLastname( string b){

lastName = b;

}

string getLastName( ){

return lastName;

}

void displayDetails( ) {

System.out.print(firstName);

System.out.print (lastName);

}

}

//Test program

Class Main{

public static void main(String args [] ){

Person person = new Person( )

person.setFirstName("Karen")

System.out.print(person.getFirstName)

person.displayDetails()

}

}

WHAT TYPES OF ACTIVITIES ARE PERFORMED BY HEALTH CARE SOFTWARES

Answers

Answer:

lectronic Health Record (EHR) Software. ...

Medical database software. ...

Medical research software. ...

Medical diagnosis software. ...

Medical imaging software. ...

E-prescribing software. ...

Telemedicine software. ...

Appointment scheduling (booking) software.

Write a list comprehension statement to generate a list of all pairs of odd posi

Answers

Answer:

Print([(a,b) for a in range(10) for b in range(10) if (a < b and a%2 == 1 and b%2 == 1)])

Explanation:

Here, we declared a range of value for a and b using a for loop and the range function. The values are the first 10 numeric digits. The we used the if statement to establish our constraints;

In other to ensure that ;

Lower digit is written first ; (a < b) ;

Only odd numbers are considered,

a%2 == 1 ; b%2 == 1 (remainder when a and b are divided by 2 is 1.

Both a and b are declared as a tuple in other to obtain a pair of odd values.

The illegal copying of program​

Answers

Answer:Software piracy

Explanation:

What are the two basic literary forms?

Answers

fiction and nonfiction

In the graph shown here, by what percentage are the number of people in computer occupations in general projected to increase?


21%

26%

10%

12%

Answers

The number of people in computer occupations in general is projected to increase at 12%

The chart

Reading the charts, we have the following entries

Software developer applications = 26%Software developer = 21%Computer occupations = 12%Software developers, system software = 10%

Using the above entries, we can conclude that:

The number of people in computer occupations in general is projected to increase at 12%

Read more about bar charts at:

https://brainly.com/question/25069221

please help

Write a method that takes 5 ints as parameters and returns the average value of the 5 ints as a double.

This method must be named average() and it must have 5 int parameters. This method must return a double.

Calling average(1, 5, 7, 4, 10) would return 5.4.

Answers

Answer:

Answered below

Explanation:

This solution is written in Kotlin programming language.

fun average (a: Int, b: Int, c: Int, d: Int, e: Int) : Double {

#variable to hold the addition of all parameters

var sum = a + b + c + d + e

#variable to hold the average of sum

var avg = sum / 5

return avg

}

#call the function to see how it works.

# this operation is done in the fun main()

var test: Double = average ( 5, 4, 7 , 3, 9)

print (test)

The default for automatic replies in outlook is what?

Answers

Answer:

The default for automatic replies in outlook is turned off, so the user has to turn it on in order to use it.

Out.look is a program developed by Micro.soft for managing e-mails, being together with G.mail one of the most used worldwide. As in most of these programs, you can configure automatic responses in order to give a quick and generic response to certain types of messages (or even all). Now, this option is disabled by default, so the user must activate it through the configuration of the email box.

The default for automatic replies in Outlook is

disabled

It is best to

schedule  automatic replies.

Automatic replies may validate your

email  to spammers.

Automatic reply rules are for

conditional  settings like forwarding a message to a coworker.

Buying a new computer for which of these reasons is most likely a sound
financial decision?
A. You liked the ad for it on TV.
B. You need it to do your homework.
O c. Your friend has one.
D. You were persuaded by a salesperson.

Answers

Answer:

b. you need it to do your homework

Explanation:

Which of the following variable names follows the rules for naming variables?
A. snack $
B. favorite_snack
C. lunch time
D. 15 minute snack

Answers

D. 15 minute snack
Sorry if wrong

Which of these devices collects the most information on network activity?

a. Intrusion detection systems.
b. System Event Management systems.
c. Firewalls.
d. Packet sniffers.

Answers

Answer:

The devices collects the most information on network activity are:

d. Packet sniffers.

Explanation:

Generally, a packet sniffer is a monitoring device which examines streams of data packets that flow between computers on a network and the larger Internet.  One of the best packet sniffers is the Wireshark.  As a packet sniffer, the Wireshark is also an analysis tool.  It captures network traffic on local networks, storing the obtained data for offline analysis.

draw internal architecture of computer​

Answers

Answer:

If this is good, let me know in the comments and I'll draw it

Explanation:

A Task can be created in Outlook 2016 by clicking on the Tasks navigation item, or by
O clicking on the View tab.
O saving a contact.
O creating an appointment.
O flagging an email.

Answers

A Task can be created in Outlook 2016 by clicking on the Tasks navigation item, or by clicking on the View tab. Thus, option A is correct.

What is a Variable Expense?‌

Business expenses can be classified as either fixed (invariable) or variable. A fixed expense does not change based on a business’s other activities. Costs like rent and administrative salaries are fixed costs, which remain the same no matter how much a business is producing. Imagine a factory that produces pencils — the cost of renting the factory building will remain the same, month after month, no matter how many pencils the company actually produces.

Variable expense ratio expresses variable expenses as a proportion of a company's sales. To calculate the variable expense ratio, simply divide the company's total variable expenses by the company's total net sales. To express the result as a percentage, simply multiply it by 100.

Therefore, A Task can be created in Outlook 2016 by clicking on the Tasks navigation item, or by clicking on the View tab. Thus, option A is correct.

Learn more about variable expense on:

https://brainly.com/question/13097236

#SPJ5

What are the three general methods for delivering content from a server to a client across a network

Answers

Answer:

Answered below.

Explanation:

The three general methods consist of unicasting, broadcasting and multicasting.

Casting implies the transfer of data from one computer (sender) to another (recipient).

Unicasting is the transfer of data from a single sender to a single recipient.

Broadcasting deals with the transfer of data from one sender to many recipients.

Multicasting defines the transfer of data from more than one sender to more than one recipients.

Select all the correct answers. Which statement will print the output 10 + 20=30

a. System.out.println("10 + 20 =30" );
b. System.out.println(10 + 20 =30);
c. System.out.println(10 + 20 =""+ (10+20));
d. System.out.println("10 + 20" =10+20);
e. System.out.println(10 + 20 ="" +10 +20);

Answers

Answer:

a

Explanation:

b will print out a boolean, true, i think

c gives an error?? i think

d seems weird

e is weird too

anyway, b,c,d,e all have bad syntax

Answer:

a

Explanation:

a term to describe article that can be displayed in their entirety as opposed to abstract and reference only?​

Answers

Answer:

would it be term and tequnique?

Explanation:

oooooooo

How to format each dictionary item as a text string in the input file. How to covert each input string into a dictionary item. How to format each item of your inverted dictionary as a text string in the output file.

Answers

Answer:

- To get the items of a dictionary and print them as a string, use the items() method to unpack the keys and values in a for and print or write them into a file.

for key, value in mydict.items():

   print(f"{key}, {value}")

- To convert string from user input into dictionary;

   mystring = input().split(" ")  #assuming the words are separated by a space.

   from word in mystring:

       mydict[word] = mydict.get(word, 0) + 1

This would use the words in the string as the keys of the dictionary and the count of each word as the respective values.

Explanation:

A dictionary is a data structure in python used to store data in key-value pairs. The items are enclosed in curly braces and can be accessed with the key in dot or bracket notation.

Dictionaries in Python are used to represent data items in pairs; i.e. key and values

(a) Format items as strings in an input file

To do this we make use of the file manipulation.

Assume the dictionary name is given as: myDict

See attachment for the complete solution

Read more about Python dictionary at:

https://brainly.com/question/14353514

Which of the following methods can be used to solve the knapsack problem?

a. Brute Force algorithm
b. Recursion
c. Dynamic programming
d. All of the mentioned

Answers

Answer: D. All of those mentioned

Explanation:

The knapsack problem is a problem that typically occurs in combinatorial optimization and is also a 2D dynamic programming example.

We should note that all the methods given in the option such as recursion, brute force algorithm and dynamic programming can all be used to solve knapsack problem.

Therefore, the correct answer is D.

Problem decomposition means
O Fixing the problem
O Solving the problem
O Breaking down tasks into smaller, manageable parts
0 None of the above
PLEASE HELPPPPPP

Answers

Answer: Breaking down tasks into smaller, manageable parts

Explanation:

The word decomposition means to break down so Problem decomposition means to break down the problem being faces into smaller parts with the reason being to be able to manage it better.

Some problems are simply too large to handle singularly because of the amount of resources that would have to be devoted. It would be better to break them down into smaller tasks that can then be be confronted one at a time with enough resources to solve them each.

The motherboard

allows the different parts of a computer to communicate
helps to keep things cool inside the tower
is the memory of the computer
is where the computer is plugged into an outlet in the wall

Answers

Answer:

a:(allows the different parts of a computer to communicate)

Explanation:

The motherboard is the main command center for the whole pc which recieves your inputs and responds by sending outputs...

NEED HELP WILL MARK BRAINLIEST AND 25 POINTS FOR ANSWER Xavier is using a query that includes a LIKE comparison operator with the value of A[a-n)" Which option would
match this operator?

Apple

Aaron

Assist

Azure

Answers

Answer:

This will match the name Aaron

Explanation:

Using square brackets around a range indicates that a single character within the range of the brackets can be match.

In something like the given example

WHERE name LIKE "A[a-n]"

It will match all names that start with a capital A, which is immediately followed by a lowercase a through n.

What will the output of the statements below? System.out.println(9%2); System.out.println(12%6); The output of the first statement is * The output of the second statement is​

Answers

Answer:

You get Exact 30 print of that sentence on a comadore 64

Explanation:

Just simple basic science. hope this helps

The ________ contains links to folders and files that Windows determines you access frequently or links that you have added.

Answers

Answer:

Quick access list

Explanation:

Normally in computers, quick access list is usually the first node in the navigation pane and it contains links to folders and files that you access frequently plus the ones that you add by yourself. Windows detects them.

. Else-if is good selection statement that help us to solve problems in C++,mostly times same problem of same nature can also be solved via switch statement. Which one you prefer to use and why?

Answers

Answer:

Else-If statements

Explanation:

Personally, I prefer using Else-If statements for conditional statements since you can start with and If statement and add to it if necessary. Aside from this, Else-If statements also allow you to add more than one condition to be met by using tags such as and or and not. Switch statements are better in scenarios where you have a set of possible inputs or results and need a specific event to happen for each input/result, but this is not as common of a scenario so Else-If is usually my go-to conditional statement.

Write a program that asks the user how many names they have. (If they have a first name, two middle names, and a last name, for example, they would type 4.) Then, using a for loop, ask the user for each of their names. Finally, print their full name.

Answers

Answer:

The solution is implemented in python:

numnames = int(input("Number of Names: "))

nametitle = ["Surname: ","Firstname: ","Middlename: ","Middlename 2: "]

names = []

for i in range(numnames):

   name = input(nametitle[i])

   names.append(name)

   

print("Your fullname is: ",end=" ")

for i in names:

   print(i,end=" ")

Explanation:

This prompts user for number of names

numnames = int(input("Number of Names: "))

This lists the name titles in a list

nametitle = ["Surname: ","Firstname: ","Middlename: ","Middlename 2: "]

This initializes an empty list

names = []

The following for loop get names from the user

for i in range(numnames):

   name = input(nametitle[i])

   names.append(name)

   

The following instructions print the user fullnames

print("Your fullname is: ",end=" ")

for i in names:

   print(i,end=" ")

An example program in Python that asks the user for the number of names they have and then prompts them to enter each name.

It will then print their full name based on the names provided:

python

Copy code

num_names = int(input("How many names do you have? "))

names = []

for i in range(num_names):

   name = input("Enter name {}: ".format(i + 1))

   names.append(name)

full_name = " ".join(names)

print("Your full name is:", full_name)

In this program, we first ask the user to enter the number of names they have. The input is converted to an integer using int() since input() returns a string.

Then, we initialize an empty list names to store the names provided by the user.

Next, we use a for loop that iterates num_names times to ask the user for each name. The loop variable i starts from 0, so we add 1 to it when displaying the prompt using i + 1.

Inside the loop, we prompt the user to enter the name and append it to the names list. After the loop completes, we join all the names in the names list using the join() method with a space as the separator. This creates a single string representing the full name.

Learn more about python on:

https://brainly.com/question/30391554

#SPJ6

Other Questions
PLEASE NEED HELP ASAP TYTY I WILL BE GIVING THANKS! .Charlie has 6 more quarters than dimes in a jar and a total of $9.20. Which system ofequations can be used to determine the number of each type of coin Charlie has ifq=the number of quarters and d = the number of dimes? Select the correct answerLinda owns a great deal of land. She decides to rent her land to Andrea. However, she places certain restrictions on Andrea regarding the land use. Linda is usingwhich rights?. .use rightsOB.alienation rightsOC. management rightsOD. ownership rightsHelp need answer ASAP !! The following graph shows a proportional relationship.What is the constant of proportionality between y and x in the graph?Constant Of Proportionality = ________ Please helpx2 + 14x + 37 = 0 6c = $75Abby has $10 in quarters. Each quarter is worth LaTeX: \frac{1}{4}1 4 dollar. Which equation can be written to determine how many quarters, q, Abby has?LaTeX: \frac{1}{4}1 4 + q = 10LaTeX: \frac{1}{4}1 4 q = 104q = 104 + q = 10 This year is snowed on five of the 12 Days of Christmas! The snowfall amounts were 2inches, 5 inches, 3 inches, 1 foot and 9 inches. What was the mean amount of snow forthe 12 days? Round your answer to the nearest HELPPP AND YOU GET CANDYYY (brainlist) HELP BEFORE I DIE OF HISTORY :3 Which has the least value for 9?*A. 1.95B. 0.1039C. 3.092D. 2.009 Simplify c x d x 4 = Under Presidential Reconstruction, Confederate leaders and wealthy Southerners had to __________ in order to regain the right to vote. a. reapply for citizenship b. receive a presidential pardon c. be approved by Andrew Hamilton d. pay additional taxes What literary devices are in this poem? (And where in the poem.) which middle eastern country is governed by a presidential dictatorship James and Noel sat on the steps of their new house. It was going to be a hot day, but the boys preferred sitting outside to unpacking more boxes inside. Their mom was unpacking kitchen stuff, and the boys had grown tired of hearing her exclaim every time she unwrapped another of the teapots she hadn't seen in months. "You'd think she'd have enough teapots by now," said James. "Yeah," said Noel, "I don't get that excited about my Godzilla collection and that is way more interesting than any teapot." "And I'm sorry," said James, "but I know way too much about teapots for a boy my age." James then started listing all the things he knew about teapots. "There's the spout and the pouring angle," he began. But Noel had already tuned James out. The heat was rising and as tired as he was of his mother's teapots, he was more tired of James' complaining. Besides, there was a raggedy old dog down the street. Noel could tell, even from far away, this was a dog that belonged to no one. Its coat was matted. It had no collar. All he could see of the dog's face was its nose sticking out. Its coat was all brown, but a dirty, grayish brown, not the deep dark warm brown that made you feel safe. "And there's that teapot with the flowers. The brown one with the little dots all in a row," James continued on his rant, now listing all the teapots he had unwrapped for Mom. Noel continued ignoring James and watched the dog. It was moving slowly in their general direction. It stopped at various spots along the curb to smell things. Sometimes the smelling took a very long time. Every now and then it would sit down to scratch behind its ear. Noel wondered if it was looking for something to eat. James jabbered on and Noel began to wonder how a dog came to be in such a sad condition as this one. Did no one ever want it? Even as a puppy, was this fellow not cute enough to find a good family? Had it always been this ugly? Hadn't anyone ever been kind to it? The dog was across the street now, one house over. It seemed to be particularly attracted to mailboxes and the plants around them. To Noel's mind, it appeared that the dog was greeting each family on the street. Noel watched the dog cross the street heading in their direction. He hadn't noticed it before, but the dog's head seemed rather large. It swung back and forth in front of its body, much like the bears Noel had seen at the zoo and on television. Noel could not see any eyes through all the matted hair. He could see gnats and flies hovering over the poor thing, waiting for it to sit down again. It lumbered toward them. Noel noticed that James had stopped talking. He looked over at his brother. Staring at the dog, James seemed to be a bit shocked or surprised, maybe even stunned. "What is that?" James whispered. Instead of sniffing their mailbox and moving on like before, the dog started up the sidewalk toward the steps where they were sitting. Noel could hear the flies buzzing and see not just a few gnats, but a whole swarm around the dog. Bits of leaves and twigs hung in its hair. The dog continued toward them. Was it going to stop, wondered Noel. Should I get up and get in the house? But then, just when Noel felt a twinge of panic, the dog sat down, wagged its tail, and smiled. Noel had never seen anything like it before. It was as if the dog, flies and all, were posing for a photographer. It is going to be an interesting summer, thought Noel.Read these lines from the text:Noel could not see any eyes through all the matted hair. He could see gnats and flies hovering over the poor thing, waiting for it to sit down again.These lines from the text tell us that (4 points) athe dog is probably a stray bthe dog has never had friends cthe dog must be dangerous dthe dog does not like people I need to write an email to cancel the IB test I registered for. Please help I am not good with emails Joey wrapped a wire around an iron bolt then connected the ends of the wire to a battery forming a complete circuit. What must have occurred as a result?(A) The energy in the circuit was lost.(B) The bolt was magnetized.(C) The bolt started spinning.(D) Nothing happened because there was no device. Are the ratios 5:4 and 17:12 equivalent? Aubrey is going to see a movie and is taking her 2 kids. Each movie ticket costs $13 and there are an assortment of snacks available to purchase for $4 each. How much total money would Aubrey have to pay for her family if she were to buy 3 snacks for everybody to share? How much would Aubrey have to pay if she bought x snacks for everybody to share? what is the correct meaning of the word secluded. hey, hows your day? please answer correctly and first best answer gets brainlest