Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Examine and study each method carefully! WRITE 3 METHODS: 1. sumArrayList() This method must return int, which is the sum each int in 1-D array.

Examine and study each method carefully! WRITE 3 METHODS: 1. sumArrayList() This method must return int, which is the sum each int in 1-D array. You must use a 'normal' for loop (counting loop). Use a wrapper Integer with number at each index. It should take about 6 lines of code, at most. 2. sumArrayListEnhancedForLoop() This method returns an int by summing each int in 1-D array, using and 'enhanced' for loop, not a counting loop. Cast from Integers with (int). It should take about 3 lines of code, at most. 3. pctNegNumbers() This method returns an int, the percent negative numbers (rounded) in array. Use an Enhanced For Loop (not a counting loop!). Round the result to an integer (no decimal places), using (int) cast of a double. This program demonstrates: ARRAYLIST - how values stored into an object - how objects must first convert to objects - ArrayList return - ArrayList .add() method - use of ArrayList .size() method STRING - use of String .length() method

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

Data Analysis And Decision Making

Authors: Christian Albright, Wayne Winston, Christopher Zappe

4th Edition

538476125, 978-0538476126

More Books

Students also viewed these Algorithms questions