Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this is the base to write the code for the parts Write a for-loop that traverses nums, removing every value that is divisible either by

image text in transcribedimage text in transcribedimage text in transcribedthis is the base to write the code for the parts

Write a for-loop that traverses nums, removing every value that is divisible either by 3 or 4 . (Remember, a is divisible by b if a%b==0 ) Afterwards, use the following instruction to verify that your code is correct: System.out.println( nums ); If correct, then the following numbers should be output when you print the ArrayList: [1,2,5,7,10,11,13] Afterwards, write a 2nd for-loop (continuing from where you left off in Part 1) that traverses the ArrayList. For each odd number it encounters, insert that value plus 30 after it (For example: If it encounters ' 3 ' at index 5 , then it should insert '33' at index 6). (Remember, a is odd if a%2==1 ) Print the ArrayList afterwards to verify that your code works. If done correctly, the following numbers should be output: [1,31,2,5,35,7,37,10,11,41,13,43]

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

Beginning C# 2005 Databases

Authors: Karli Watson

1st Edition

0470044063, 978-0470044063

More Books

Students also viewed these Databases questions

Question

4. Describe cultural differences that influence perception

Answered: 1 week ago