ASSIGNMENT 2B
Assignment 2B tests your knowledge of sorting algorithms (Chapter 23). For the assignment, you are going to design a
class (the program/project/driver class file should be called YourNameAssignment2B; replace YourName with your actual
name) without any fields, just the exact methods (with exact1 names, parameters, return values, and functionality):
Method Name Description
YourNameGetSize A method without parameters that reads a valid integral number N between 10 and 20 from
the user (if the number is not valid the methods should ask for a new integral number until
the number is correct) and returns it
YourNameGetArray A method with an integral parameter N that reads N integral numbers from the user, stores
them into an array A, and returns the array A.
YourNameCopyArray A method with an integral array A and an integral number N as parameters that create an
array B with the same N integral numbers as A and returns it.
YourNamePrintArray A method with an integral array A and an integral number N as parameters that prints the
array A of N integers to the console.
YourNameInsertionSort A method with an integral array A and an integral number N as parameters that sorts the
array A of N integers using insertion sort algorithm.
YourNameBubbleSort A method with an integral array A and an integral number N as parameters that sorts the
array A of N integers bubble sort algorithm.
YourNameMergeSort A method with an integral array A and an integral number N as parameters that sorts the
array A of N integers using merge sort algorithm.
YourNameQuickSort A method with an integral array A and an integral number N as parameters that sorts the
array A of N integers using quick sort algorithm.
YourNameHeapSort A method with an integral array A and an integral number N as parameters that sorts the
array A of N integers heap sort algorithm.
main
▪ Use the YourNameGetSize method to get the size of the array and store it in variable
YourNameArraySize
▪ Use the YourNameGetArray method with parameter YourNameArraySize to read an
array of YourNameArraySize integers from the user and store the returned array in
variable YourNameArray
▪ Use the YourNameCopyArray method 5 times to create copies of the YourNameArray
and store the returned arrays in the following 5 variables YourNameArrayI,
YourNameArrayB, YourNameArrayM, YourNameArrayQ, and YourNameArrayH.
▪ Use the YourNameInsertionSort method to sort the array YourNameArrayI
▪ Use the YourNameBubbleSort method to sort the array YourNameArrayB
▪ Use the YourNameMergeSort method to sort the array YourNameArrayM
▪ Use the YourNameQuickSort method to sort the array YourNameArrayQ
▪ Use the YourNameHeapSort method to sort the array YourNameArrayH
▪ Use the YourNamePrintArray method 5 times to print the YourNameArrayI,
YourNameArrayB, YourNameArrayM, YourNameArrayQ, and YourNameArrayH array.
Before each call, output messages to inform the user which array/sorting method you
are printing.
Create a Microsoft Word screenshots document called YourNameAssignment2B-Screenshot x (replace YourName
with your actual name) that contains screenshots of the entire JAVA source code in the editor window (for all the JAVA
classes) and the entire output window (from the driver class). If the entire class JAVA source code or the output does not
fit in one screenshot, create multiple screenshots and add them to the document.
Submit YourNameAssignment2B.java Java source code and YourNameAssignment2B-Screenshots x screenshots
document on eCampus under Assignment 2B. Do not archive the files (no ZIP, no RAR, etc.) or submit other file formats.
1 Use the exact names (spelling, caps), parameters, returned values, functionality, and do not add or remove fields or methods. Yes, you may find
examples in the textbook with different names and cases and with other methods, but you will need to adapt them to have this exact names and
cases, to earn credit for the assignment. You can add additional helper/utility method to use in your sorting methods.