Question: 1) Write a program named Algorithms.java that contains the bubbleSort and swap methods from class, except that you will name these two methods bubbleSortintAscending and

1) Write a program named Algorithms.java that contains the bubbleSort and swap methods from class, except that you will name these two methods bubbleSortintAscending and swapint, respectively.


2) To Algorithms.java, add the following static methods:
bubbleSortintDescending- sort an array in descending order using the bubble sort algorithm
 

3) Write a program named AlgorithmsTest that declares and initializes two unsorted arrays. The program will then print the unsorted int arrays (you may need to figure out how to do this so you can see the values), sort the int array using bubbleSortIntAscending, reprint the array, sort it again using bubbleSortintDescending and print it.
 

4) Additionally test the program by attempting to pass a null value to either of the bubble sort algorithms. Comment out the code that does this before vou turn in the test program. The program SHOULD NOT crash because of this. Instead, print out an explanation of what happened IN the program so that it appears as part of the program output.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!