Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions Complete the getOdds method so it returns a new ArrayList of Integers containing all odd Integers from the parameter ArrayList vals in the order

image text in transcribed
image text in transcribed
image text in transcribed
Instructions 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. Files STATUS NOT SUBMITTED SAVE SUBMIT 2 UZ_L2_Activity_Three.java 4 runner_U7_L2_Activity_T... 1 - import java.util.ArrayList; 3 - public class U7_LZ_Activity Three 5. public static ArrayList getOdds (ArrayList vals) { 6 1 // Implement this method as described in the assignment 7 } 8 9) 10 Files STATUS O NOT SUBMITTED SAVE SUBMIT IN 1 - import java.util.Scanner; 2 import java.util.ArrayList; U7_L2_Activity. Three.java 3 runner_U7_L2_Activity_T... 4 - public class runner_U7_L2_Activity Three 5 7 8 9 10 6. public static void main(String[] args) { Scanner scan = new Scanner(System.in); ArrayList nums = new ArrayList; System.out.println("Enter ArrayList length: "); int len-scan.nextInt(); 11 System.out.println("Enter values:"); for(int i = 0; i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

More Books

Students also viewed these Databases questions

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago