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
Helga [31]
3 years ago
13

Write a program that reads in 10 numbers from the user and stores them in a 1D array of size 10. Then, write BubbleSort to sort

that array – continuously pushing the largest elements to the right side
Computers and Technology
1 answer:
Diano4ka-milaya [45]3 years ago
8 0

Answer:

The solution is provided in the explanation section.

Detailed explanation is provided using comments within the code

Explanation:

import java.util.*;

public class Main {

//The Bubble sort method

public static void bb_Sort(int[] arr) {  

   int n = 10; //Length of array  

   int temp = 0; // create a temporal variable  

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

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

           if(arr[j-1] > arr[j]){  

               // The bubble sort algorithm swaps elements  

               temp = arr[j-1];  

               arr[j-1] = arr[j];  

               arr[j] = temp;  

             }  

         }            

         }  

        }

 public static void main(String[] args) {

   //declaring the array of integers

   int [] array = new int[10];

   //Prompt user to add elements into the array

   Scanner in = new Scanner(System.in);

   //Use for loop to receive all 10 elements

   for(int i = 0; i<array.length; i++){

     System.out.println("Enter the next array Element");

     array[i] = in.nextInt();

   }

   //Print the array elements before bubble sort

   System.out.println("The Array before bubble sort");

   System.out.println(Arrays.toString(array));

   //Call bubble sort method

   bb_Sort(array);  

               

   System.out.println("Array After Bubble Sort");  

   System.out.println(Arrays.toString(array));

 }

}

You might be interested in
What effects convert colors in a picture to a wide variety of hues?
nadezda [96]
I believe it's color saturation.
3 0
3 years ago
What automatically created subdomain holds all the SRV records for Microsoft-hosted services, such as the global catalog, LDAP,
nevsk [136]

Answer:

The correct answer to the following question will be "_msdcs".

Explanation:

Msdcs directory known as Microsoft Domain Controller Catalog requires SRV documents that are used to identify domain controller for certain operations.

  • It automatically generated subdomain keeps all Microsoft-hosted resources SRV data, so it's the correct answer.
  • It includes common SRV documents, documents of LDAP, documents of Kpass, CNAME, etc.
7 0
4 years ago
Importance of good safe design
KengaRu [80]

Answer:

Safe design incorporates ergonomics principles as well as good work design. Good work design helps ensure workplace hazards and risks are eliminated or minimised so all workers remain healthy and safe at work.

Explanation:

Good work design, or safety in design, considers hazards and risks as early as possible in the planning and design process. It aims to eliminate or minimise the possibility of workplace injury or illness throughout the life of the product or process. ... products. layout and configuration

3 0
3 years ago
Read 2 more answers
if you want to open up your desktop computer to look inside what is one of the first things you should do
Sunny_sXe [5.5K]
Turn it on or open the laptop
7 0
4 years ago
Of the listed principles, which process would transpire if a user provides a correct username and password?
kompoz [17]

Answer:

then the system will automatically grant access to that individual

Explanation:

Regardless of the system, a username and password are credentials used in order to prevent unauthorized access to the system. Therefore if a user provides the correct username and password when prompted, then the system will automatically grant access to that individual, since the account that they have logged in correctly as is already registered as an authorized account within the system.

5 0
3 years ago
Other questions:
  • Which form of Internet access currently uses a technology called 4G?
    15·2 answers
  • Show the stack with all activation record instances, including static and dynamic chains, when execution reaches position 1 in t
    14·1 answer
  • Write a program that prompts a user to enter numeric values. As each value is entered, the program should: - Append the value to
    7·1 answer
  • Server 2016 is compatible for Powershell 5.0 State True or False.
    7·1 answer
  • The scope of a variable declared inside of a function is:
    9·1 answer
  • Which options are available when a business creates a new theme? Check all that apply.
    12·1 answer
  • The current standard for RFID is based off of Group of answer choices MIT standards IEEE standards ISO standards there is no agr
    12·1 answer
  • What is the relationship between hardware and software technology tools?
    7·2 answers
  • Is e commerce a challenge or opportunity to the freight forwarder
    8·1 answer
  • What does this comparison block indicate?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!