$30
PROGRAMMING II
Pair Programming is allowed (but not required) for this assignment.
This Assignment involves designing and developing an application to sort and display the names
and programming assignment scores of several students. After loading these students names and
scores from a file, the user will be able to repeatedly re-sort these students according to their scores
on different assignments. Each time these students are sorted, the user will also be able to choose
the properties of the sorting algorithm used for this sorting.
OBJECTIVES AND GRADING CRITERIA
The main goals of this assignment include implementing a few different sorting algorithms, and
gaining experience applying the organizational principles of OOP to your own codebase.
5
points
1 zyBooks Tests: automated grading test results are visible upon submission, and
allow multiple opportunities to correct the organization and functionality of your
code. Your highest scoring submission prior to the deadline will be recorded.
10
points
2 Hidden Tests: automated grading tests are run after the assignment’s deadline.
They check for similar functionality and organizational correctness as the zyBooks
Tests. But you will NOT be able to resubmit corrections for extra points, and
should therefore consider and test your own code even more thoroughly
10
points
Appropriate choice and implementation of sorting algorithms. Reviewed by human
graders.
P11 ALL SORTS OF STUDENTS
LECTURE NOTES
15
points
Appropriate use of OOP constructs: objects, classes, exceptions, inheritance,
interfaces, and, generics. Reviewed by human graders.
10
points
Final Submission Commenting, Style and Organization: human graders will review
the commenting, style, and organization of your final submission. They will be
looking for clear comments and consistent style that make appropriate use of java
constructs, conforms to this write-up and the CS300 Course Style Guide, while
contributing to the readability of your code.
GETTING STARTED
0. Create a new Java8 project in Eclipse. You can name this project whatever you like, but
AllSortsOfStudents is a descriptive choice. Then create a new class named Main within a
Main.java file, and include a public static void main(String[] args) method stub as the driver for
your application.
1. This assignment is different from past assignments in that you are given full responsibility for the
design and organization of code into classes, fields, methods, exceptions, interfaces, etc. In order
for us to collect these solutions with unspecified filenames through zybooks, we will need to you
to collapse the code for your final submission into a single file by following these instructions:
a. Create a separate new project in eclipse with a single file called Main.java.
b. Copying the contents of your old Main.java file into this new project.
c. Then append the code from each class and interface used by your program into the end of
this Main.java file. In order for this code to compile and run as it had before, you’ll need to
remove the public access modifier from the front of each class and interface declaration
(Note: Do not remove these modifiers from any members within any classes or
interfaces). Also be sure to move all import statements to the top of this file.
d. Test this single-file version of your code to make sure it functions as intended.
e. This final submission only needs a single file header at the top, and the source files listed
within that header should include all of the file names from your original project.
2. Since you are responsible for the organization of your code in this assignment, please be sure to
consider and incorporate the following design decisions into your solution:
Make sure that none of your classes are responsible for too many different things. For
example, you should not be implementing more than one sorting algorithm within a single
class.
Attempt to make your code both clear and general. For example, you should try to use
interface, superclass, and generic references to make your code more clear (communicating
how objects are actually used) and more general (so it can be used with more types of
objects).
Prevent, throw, and handle exceptions in ways that are consistent with your understanding
of how these constructs are meant to be used in Java.
STUDENT DATA FILES
3. When your program is executed, the first thing it should ask for is the name of a plain text file to
load student data from. Within the specified file, your program should load one line of text per
student. Each line will begin with a student’s name followed by a colon (:) character. After the
colon will be a comma (,) separated list of integer assignment scores. The number of assignment
scores listed for each student must be consistent throughout a given file. Your program should be
able to handle any number of assignment scores (assuming sufficient memory is available). Your
program should not be sensitive to the spacing of this file’s content, other than the fact that each
new line in the file contains the name and scores of a different student. Here are some sample
files that conform to this data format specification: test01.txt, test02.txt, test03.txt. Handle any
errors found while loading this data as you see fit.
SORTING AND DISPLAYING THE STUDENTS SCORES
4. After loading a file full of student scores, your program should immediately display those
students scores in alphabetical order by name (treat all names as a single string, do not attempt
to divide into given vs family parts). The format used for displaying student scores should be
consistent with the file format specification above.
5. After displaying the students’ scores alphabetically by name, the user should be repeatedly given
the option to re-sort and re-display these scores either alphabetically or according to the students’
scores on a particular assignment, and each time they may select the characteristics of the sorting
algorithm that is used. Aside from Q: the command to quit, every other command must be
composed of a letter followed by a number:
a. The letter entered by the user (case insensitive) corresponds to the characteristics of the
sorting algorithm that will be used to sort this data. Each letter corresponds to one of the
following sorting algorithms: Insertion Sort, Selection Sort, and Heap Sort. Part of your job
for this assignment is to determine which sorting algorithm exhibits the properties of each
option:
O Optimal Time Complexity O(nlogn)
A Adaptive (Faster for Nearly Sorted Data), but O(n^2) Time Complexity
F Fewest Swaps (O(n)), but O(n^2) Time Complexity
b. The number entered by the user will determine the key that data should be sorted according
to. Zero corresponds to sorting alphabetically by name, one corresponds to sorting
numerically from smallest to largest by the first assignment score, two by the second
assignment score, and so on.
6. Here is an interactive log that demonstrates using the complete application (the user’s input is
displayed in a orange and the output is in black). Your prompts and how you handle various
errors will not be tested by our automated tests. But your program must work with the minimal
commands demonstrated below (without requiring any extra input from the user), and it must
display the names and scores in the correct order after each command is entered.
Enter the name of your student data file: test03.txt
AAA: 1, 2, 3
BBB: 3, 1, 2
CCC: 2, 3, 1
o 2
BBB: 3, 1, 2
AAA: 1, 2, 3
CCC: 2, 3, 1
a3
CCC: 2, 3, 1
BBB: 3, 1, 2
AAA: 1, 2, 3
f0
AAA: 1, 2, 3
BBB: 3, 1, 2
CCC: 2, 3, 1
q
7. Remember that you are being graded on your use of OOP design, and your use of the constructs
covered in this course. Be sure that your design demonstrates your understanding of and makes
appropriate use of: objects, classes, exceptions, interfaces, and, generics.
8. Congratulations on finishing this final CS300 assignment! After verifying that your work is
correct, and written clearly in a style that is consistent with the course style guide, you should
submit your work through zybooks. The most recent of your highest scoring submissions prior to
the deadline of 17:00 on Thursday, December 7th will be used as part of your score for this
assignment. Additional grading tests will then be run against your highest scoring submission,
and human graders will also review your choice and implementation of sorting algorithms, your
use of OOP constructs in Java, and your commenting, style, and code clarity to determine the rest
of your assignment grade.