Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Section 1 : 1 . Add your section comment to the code. 2 . Print * * * * * * * * * *

Section 1:
1. Add your section comment to the code.
2. Print ********** Section 1 Bubble Sort **********
3. Print a blank line.
4. Create an array called studentGrades and populate the array with the following grades: 65,95,75,55,56,90,98,88,97, and 78.
5. Create a method called sortArrayDescBS() which implements a bubble sort algorithm that will sort the grade array from highest to lowest.
6. Create a method called sortArrayAscBS() which implements a bubble sort algorithm that will sort the grade array from lowest to highest.
7. Create a method called printArray() which will print the contents of an integer array passed to it.
8. On a new line, print The unsorted list of grades is, followed by the contents of the unsorted array using the printArray() method.
9. Print a blank line.
10. Call the sortArrayDescBS() method.
11. On a new line, print The grades in descending order are, followed by the newly sorted array using the printArray() method.
12. Call the sortArrayAscBS() method.
13. On a new line, print The grades in ascending order are, followed by the newly sorted array using the printArray() method.
Section 2:
1. Add your section comment to the code.
2. Print a blank line.
3. On a new line, print *********** Section: 2 Quick Sort *********** to the console.
4. Print a blank line.
5. Create a method called sortArrayDescQS() which implements a quick sort algorithm, using recursion, that will sort the grade array from highest to lowest.
6. Create a method called sortArrayAscQS() which implements a quick sort algorithm, using recursion, that will sort the grade array from lowest to highest.
7. For the following steps, use the original unsorted grades array from Section 1.
8. On a new line, print The unsorted list of grades is, followed by the contents of the unsorted array using the printArray() method.
9. Print a blank line.
10. Call the sortArrayDescQS() method.
11. On a new line, print The grades in descending order are, followed by the newly sorted array using the printArray() method.
12. Call the sortArrayAscQS() method.
13. On a new line, print The grades in ascending order are, followed by the newly sorted array using the printArray() method.
Section 3:
1. Add your section comment to the code.
2. Print a blank line.
3. On a new line, print *********** Section: 3 Sequential Search *********** to the console.
4. Print a blank line.
5. 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.
6. Call the seqSearch() method passing it a copy of the grades array sorted in ascending order and the value 75.
7. On a new line, print The contents of the grade array are, followed by the sorted grade array used.
8. Print a blank line.
9. On a new line, print the message returned from the search method.
10. Call the seqSearch () method a second time, passing it the same copy of the sorted grades array along with the value 60.
11. Print a blank line.
12. On a new line, print the message returned from the search method.
Section 4:
1. Add your section comment to the code.
2. Print a blank line.
3. On a new line, print *********** Section: 4 Binary Search *********** to the console.
4. Print a blank line.
5. 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.
6. Call the binarySearch() method passing it the same copy of the sorted grades array from Section 3 and the value 56.
7. On a new line, print The contents of the grade array are, followed by the sorted grade array used.
8. Print a blank line.
9. On a new line, print the message returned from the search method.
10. Call the seqSearch () method a second time, passing it the same copy of the sorted grades array along with the value 50.
11. Print a blank line.
12. 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

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions

Question

6. Be able to choose and prepare a training site.

Answered: 1 week ago