Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write the following method that sorts an ArrayList of numbers: public static void sort(ArrayList list) Write a test program that prompts the user to enter

Write the following method that sorts an ArrayList of numbers:

public static void sort(ArrayList list)

Write a test program that prompts the user to enter five numbers, stores them in an array list, and displays them in increasing order.

This is the code I have so far and I am stuck:

import java.util.Scanner; import java.util.ArrayList; public class ArrayLists {

/** * @param args the command line arguments */ public static void main(String[] args) { Scanner scanner = new Scanner(System.in); } public static void sort(ArrayList list) { Scanner scanner = new Scanner(System.in); ArrayList numbers = new ArrayList(); System.out.println(" Please enter the numbers: "); while (scanner.hasNextInt()) { list.add(scanner.nextInt()); } } } }

What other code should I be putting into this. Thank you.

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

Oracle Database Upgrade Migration And Transformation Tips And Techniques

Authors: Edward Whalen ,Jim Czuprynski

1st Edition

0071846050, 978-0071846059

More Books

Students also viewed these Databases questions

Question

=+3. What resources will these tactics require?

Answered: 1 week ago