Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN JAVA public static void main(String[] args) 1+ import java.util.ArrayList;. 30 /* 4 * This program finds the largest and smallest numbers in an array

IN JAVAimage text in transcribed

public static void main(String[] args) 1+ import java.util.ArrayList;. 30 /* 4 * This program finds the largest and smallest numbers in an array list of integers 5 */ 6 public class FindMinAndMax 7 80 9 10 String data = "45 72 35 90 12 3 204 317 684 23 44"; 11 ArrayList values = new ArrayList(); 12 13 Scanner in = new Scanner(data); 14 while (in.hasNextInt() 15 { 16 values.add(in.nextInt()); 17 } 18 19 // Find the largest and smallest value in array list values 20 int largest = values.get(0); 21 int smallest = values.get(0); 22 //-- -Start below here. To do: approximate lines of code = 5 23 // Loop through the remaining integer elements in values and update largest and smallest 24 25 26 27 28 29 30 31 32 1/ -End here. Please do not remove this comment. Reminder: no changes outside the todo regions. 33 System.out.println("Largest = " + largest + " Smallest = " + smallest); 34 System.out.println("Expected: Largest = 684 Smallest = 3"); 35 } 36 37 }

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

Seven NoSQL Databases In A Week Get Up And Running With The Fundamentals And Functionalities Of Seven Of The Most Popular NoSQL Databases

Authors: Aaron Ploetz ,Devram Kandhare ,Sudarshan Kadambi ,Xun Wu

1st Edition

1787288862, 978-1787288867

More Books

Students also viewed these Databases questions

Question

Name and describe the functions of the cartilages of the larynx.

Answered: 1 week ago

Question

were correct), and

Answered: 1 week ago

Question

Be familiar with the five basic ways to manage demand.

Answered: 1 week ago