1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ololo11 [35]
3 years ago
10

12.2 Sort an array in ascending order Write a program that gets a list of integers from input, and outputs the integers in ascen

ding order (lowest to highest). The first integer indicates how many numbers are in the list. Assume that the list will always contain less than 20 integers. Ex: If the input is:
Computers and Technology
1 answer:
notsponge [240]3 years ago
7 0

Answer:

Explanation:

The following code is written in Java, it asks the user for the number of inputs that will be made and then the inputs. These inputs are placed into an array. Then the array is sorted and printed out to the terminal.

public static void sortArrayList() {

           ArrayList<Integer> sortedList = new ArrayList();

           Scanner input = new Scanner(System.in);

           System.out.println("Enter number of digits in Array");

           int numberOfInputs = input.nextInt();

           for (int i = 0; i < numberOfInputs; i++) {

                   System.out.println("Enter a number");

                   sortedList.add(input.nextInt());

           }

           int n = sortedList.size();

           for (int i = 0; i < n; i++)

               for (int j = 0; j < n-i-1; j++)

                   if (sortedList.get(j) > sortedList.get(j + 1))

                   {

                       // swap arr[j+1] and arr[j]

                       int temp = sortedList.get(j);

                       sortedList.set(j, sortedList.get(j + 1));

                       sortedList.set(j + 1, temp);

                   }

           for (int x : sortedList) {

               System.out.println(x);

           }

       }

You might be interested in
Xml is used to format the structure and style of a web page. true or false
VLD [36.1K]
Xml is used to format the structure and style of a web page. true
7 0
2 years ago
4. True or False? Electrons flow out from the POSITIVE end of a battery. *<br> True<br> False
lana66690 [7]
False electrons put off a negative charge
4 0
3 years ago
List one unprofessional AND one professional example of internet/social media
Leni [432]

Professional: Using social media to advertise a company you created

Unprofessional: Using social media to watch cat videos

4 0
2 years ago
How to convert a .enw file into a .pdf without downloading any applications? (If I have to, then I will. Just please tell me.)
kolezko [41]

Answer: use this link :- https://www.file-extension.info/conversion/enw-to-pdf

Explanation:

7 0
2 years ago
Read 2 more answers
¿Cómo es la onda percibida por un osciloscopio cuando hablamos de sonido? ¿Qué parámetros podemos observar en ella?
frozen [14]

Answer:

Las ondas de sonido, que es una onda longitudinal, son producidas por la vibración de un objeto de tal manera que (la onda de sonido requiere un medio de viaje, líquido sólido o gas) la dirección del sonido es la misma que la dirección de la vibración y como la el ancho de la vibración (hacia adelante y hacia atrás) aumenta, la amplitud de la vibración aumenta y el sonido es más fuerte

Un micrófono conectado al osciloscopio recoge el medio de aire vibrante de la onda de sonido de la energía de la onda de sonido y lo convierte (produce) señales eléctricas y electrónicas. El osciloscopio, que está diseñado para mostrar señales electrónicas, muestra las señales electrónicas transmitidas por el micrófono en la pantalla con los mismos valores de amplitud y frecuencia que el volumen y el tono de la onda de sonido, respectivamente.

Las características observables son;

1) El volumen o el volumen de la onda de sonido que se muestra como la amplitud) en el cátodo, con una amplitud más alta que representa un sonido más fuerte

2) El tono de la onda de sonido se muestra como el espaciado de onda en el osciloscopio, el sonido de tono más alto se muestra por las ondas que se acercan en la pantalla

Explanation:

7 0
3 years ago
Other questions:
  • Yahoo and Google are examples of __________ used to perform Internet research.
    14·2 answers
  • To determine the average of a range of numbers, click the ____ in the formula bar, then click average.
    13·1 answer
  • For the sake of maximizing hardware utilization in a multicore system with a many to many threading model, the relationship of t
    12·1 answer
  • HELP PLEASE
    7·1 answer
  • Select three advantages of cloud computing.
    10·1 answer
  • The symbol located to the left of a code number that identifies a code description that has been revised is _____.
    12·1 answer
  • Why does this website have so many copies of plagiarism?
    5·1 answer
  • Which of the following statements is TRUE of a peer-to-peer network?
    10·1 answer
  • Después de un incidente de seguridad del cliente, el equipo realiza un análisis en profundidad de cada paso dado por los atacant
    6·1 answer
  • Which statement best describes the computers all around us?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!