Download CS3-Project-04

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Computer Science 3
Project # 04
Instructor: Dr. Hanh Pham
1) Requirements:
Write Java code for two classes in two given files “Sorting.java” and “SortTest.java”.
 “Sorting.java” should have, at least, the following methods: selectionSort, insertionSort, bubbleSort,
quickSort, and mergeSort methods which implement the corresponding sorting methods. It should also
DISPLAY the the comparison, swap, and pivot elements as well as the merging.
 “SortTest.java” should:
1) GENERATE randomly a number(arrayLength) of unsorted integers, put them in 5 different
ARRAYs and DISPLAY this array on the screen and also WRITE it to the text file
”_MyRandomData.txt” (see that file for the writing format).
2) Read the integers from a file named “aRandomData.txt”, (you can make a copy of
”_MyRandomData.txt”, see that file for the writing format). Insert them to 5 different
ARRAYs and DISPLAY this array on the screen.
3) Then, it should call the selectionSort, insertionSort, bubbleSort, quickSort, and mergeSort
methods in Sorting.java to sort the corresponding array. DISPLAY the array AFTER sorting
on the screen and also WRITE it to a text file for each method. See the “ScreenOutput.txt” for
more details.
4) Next, it should GENERATE a number(arrayLength) of pre-sorted integers, put them in 5
different ARRAYs. DISPLAY this array on the screen and also WRITE it to the text file
“_MyPresortedData.txt”.
5) Read the integers from a file named “aPresortedData.txt” (you can make a copy of
“_MyPresortedData.txt”, see that file for the writing format). Insert them to 5 different
ARRAYs and DISPLAY this array on the screen.
6) Then, it should call the selectionSort, insertionSort, bubbleSort, quickSort, and mergeSort
methods in Sorting.java to sort the corresponding. DISPLAY the array AFTER sorting on the
screen and also WRITE it to a text file for each method. See the “ScreenOutput.txt” for more
details.
List of data files:
2) Submission:
2.1 What to submit:
+ a tar/zip file of your codes called “YourLastNameFirstInitial-p04.tar/zip”
(VERY IMPORTTANT) for each homework, create a directory/folder called “YourLastNameFirstInitial-N”( N
is the homework number, example: “SmithJ-04”) where you store all the necessary files and where you will work
on your project. Pack tar/zip this directory/folder into a file called “YourLastNameFirstInitial-N.tar/zip”. Make
sure that this directory includes at least the following 2 files:
 “Sorting.java”
 “SortTest.java”
2.2 Where to submit: go to http://cs.newpaltz.edu/~phamh/ac3/sub/ and select the right project number. Make
sure that you fill the form correctly (VERY IMPORTANT). Upload your files.
3) Deadline: please see the SCHEDULE at our website
 Submit on the 1st day after the deadline(exp. the17th for a deadline on the 16th): 50% penalty
(example: a project gets 10 but was submitted late 1 day, the final score will be 5)
 NO GRADING if submit 2 days or more after the deadline (on the 18th and after).