Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 1-Fix code Submit a working program called: ArrFix.java Fix the following code so that the program runs. The comments (in red) tell you what

image text in transcribed

Problem 1-Fix code Submit a working program called: ArrFix.java Fix the following code so that the program runs. The comments (in red) tell you what the code should be doing. *Hi1: You may find it helpful to look up the ArrayList class online and look at the methods in the class. *Hint 2: You may also find it helpful to look at the EXTRAs section of ClassCode18. import java.util.ArrayList; import java.util.Scanner; public class ArrFix /*This method should return an integer entered by the user public static void getUserlnput() Scanner in-new Scanner(System.in); System.out.println("Enter a number or -1 to quit."); boolean done=true int n-0 /*This while loop should run until the user enters a number-once a number is entered, the loop should terminate while(done) try n-in.nextlnt catch(Exception e) System.out.println("That is not a number. Please enter an number."); in.nextLine) return done /*This method should take an ArrayList of integers and print out all elements*/ public static printOutList(a) System.out.printin("Currently in the list") for(int i=0;ica.s.ze(); ++) Each element is printed out/ System.out.printf("%d ", a); System.out.println(In")

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_2

Step: 3

blur-text-image_3

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

The Database Relational Model A Retrospective Review And Analysis

Authors: C. J. Date

1st Edition

0201612941, 978-0201612943

More Books

Students also viewed these Databases questions