Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Advances In Databases And Information Systems 22nd European Conference Adbis 2018 Budapest Hungary September 2 5 2018 Proceedings Lncs 11019

Authors: Andras Benczur ,Bernhard Thalheim ,Tomas Horvath

1st Edition

3319983970, 978-3319983974

More Books

Students also viewed these Databases questions

Question

Question What are the requirements for a SIMPLE 401(k) plan?

Answered: 1 week ago