Question
I need this in Java. Please and thank you. Section 1: Add your section comment to the code. Print ********** Section 1 Bubble Sort **********
I need this in Java. Please and thank you.
Section 1:
Add your section comment to the code.
Print ********** Section 1 Bubble Sort **********
Print a blank line.
Create an array called studentGrades and populate the array with the following grades: 65, 95, 75, 55, 56, 90, 98, 88, 97, and 78.
Create a method called sortArrayDescBS() which implements a bubble sort algorithm that will sort the grade array from highest to lowest.
Create a method called sortArrayAscBS() which implements a bubble sort algorithm that will sort the grade array from lowest to highest.
Create a method called printArray() which will print the contents of an integer array passed to it.
On a new line, print The unsorted list of grades is, followed by the contents of the unsorted array using the printArray() method.
Print a blank line.
Call the sortArrayDescBS() method.
On a new line, print The grades in descending order are, followed by the newly sorted array using the printArray() method.
Call the sortArrayAscBS() method.
On a new line, print The grades in ascending order are, followed by the newly sorted array using the printArray() method.
Section 2:
Add your section comment to the code.
Print a blank line.
On a new line, print *********** Section: 2 Quick Sort *********** to the console.
Print a blank line.
Create a method called sortArrayDescQS() which implements a quick sort algorithm, using recursion, that will sort the grade array from highest to lowest.
Create a method called sortArrayAscQS() which implements a quick sort algorithm, using recursion, that will sort the grade array from lowest to highest.
For the following steps, use the original unsorted grades array from Section 1.
On a new line, print The unsorted list of grades is, followed by the contents of the unsorted array using the printArray() method.
Print a blank line.
Call the sortArrayDescQS() method.
On a new line, print The grades in descending order are, followed by the newly sorted array using the printArray() method.
Call the sortArrayAscQS() method.
On a new line, print The grades in ascending order are, followed by the newly sorted array using the printArray() method.
Section 3:
Add your section comment to the code.
Print a blank line.
On a new line, print *********** Section: 3 Sequential Search *********** to the console.
Print a blank line.
Write a method named seqSearch() which accepts an integer array and a value to find in the array. Have the seqSearch() method return a string message stating the index in the array where the value sought was located or a message stating the value was not located in the array.
Call the seqSearch() method passing it a copy of the grades array sorted in ascending order and the value 75.
On a new line, print The contents of the grade array are, followed by the sorted grade array used.
Print a blank line.
On a new line, print the message returned from the search method.
Call the seqSearch () method a second time, passing it the same copy of the sorted grades array along with the value 60.
Print a blank line.
On a new line, print the message returned from the search method.
Section 4:
Add your section comment to the code.
Print a blank line.
On a new line, print *********** Section: 4 Binary Search *********** to the console.
Print a blank line.
Write a method named binarySearch() which accepts an integer array and a value to find in the array. Have the binarySearch() method return a string message stating the index in the array where the value sought was located or a message stating the value was not located in the array.
Call the binarySearch() method passing it the same copy of the sorted grades array from Section 3 and the value 56.
On a new line, print The contents of the grade array are, followed by the sorted grade array used.
Print a blank line.
On a new line, print the message returned from the search method.
Call the seqSearch () method a second time, passing it the same copy of the sorted grades array along with the value 50.
Print a blank line.
On a new line, print the message returned from the search method.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started