COP 2551 Summer 2004 Programming Assignment 4 ======================== You are to write a java program that will perform the tasks described below and demonstrated in class. Be aware that there is a Cls.java class in the Program4 public subdirectory. You should begin using this class to clear the screen (this will also be demonstrated in class). Your program must implement multiple classes, including an InsertionSort class that accepts an array of Comparable objects and a Student class that implements the Comparable Interface. UML class diagrams are also provided in the Program4 public subdirectory. Your program is to implement the classes and methods shown in those diagrams and described below: 1. A driver class named ClassAverages.java that: a. b. c. Asks the user how many students they want to enter and will then loop to instantiate that many Student objects and assign them to a Student array. Calls the insertion sort to sort in ascending order the array of student objects based on last name, first name, middle initial. Displays each student's name and their averages. A sample of user input and program output will be available in a Microsoft Word file in the Program4 public subdirectory. 2. An InsertionSort.java class with a method that implements an insertion sort that takes an array of Comparable objects. See the selection and insertion sorts on pages 343-344 of our text. 3. A Student.java class that includes: a. A constructor that will invoke other constructors to create a Name object and a Grades object and store them in name and grades instance variables. b. A compareTo() method that implements the Comparable interface to compare student names for use by the InsertionSort class. The comparison is to be based on last name, first name and middle initial. c. A toString()method that will create a string that can be used to display all the data for a student. The method can concatenate objects from the Name and Grades classes to help accomplish this. Of course, this means that the Name and Grades Classes must implment their own toString() methods. 4. A Name.java class that includes: a. A constructor that will invoke other methods as needed. b. A method that will obtain the student's last name, first name, and middle initial from the user and store them in instance variables. c. A toString() method that formats the desired display of a student's name. 5. A Grades.java class that includes: a. A constructor that invokes methods to populate integer arrays (instance variables) with quiz grades, program grades, and exam grades and also invoke a method that will calculate the necessary averages (based on the weights used in this course)and store them in instance variables. b. A toString() method that formats the averages and final exam grade as well as the final course average. Comments, style of indenting and spacing between portions of the program should follow that of the previous programs and what I have demonstrated in class. You are encouraged to use the clear screen method that I have placed in the public subdirectory. The turnin code will be higbee.cop2551_43.p4. This assignment is due on Tuesday, July 6th at the start of class. Note that we will cover arrays on Thursday, June 24th, but you will have an exam on Tuesday, June 29th. That will give you a week following the exam to complete Program 4. You should plan for a very busy weekend finishing this project. If possible, begin working no later than after the exam on Tuesday so you can ask questions that Thursday. In addition to the electronic turnin, you are to turnin a folder (not a notebook) that contains in the following order: 1. Your name, class and section number on the front cover. 2. A page that has your name, class, section number, and a brief description of what your program does. 3. A printout of your code. 4. Copies of the class diagrams I have provided with any changes necessary to show what your programs actually did. 5. Discussion of how you tested your program. 6. A statement about your success in completing the assignment, including discussion of any problems you encountered and your success (or lack of success) in solving them. Added bonus worth 10 points. Include after your display of averages, the same message that you displayed in Program 3, but make it apply to the course average.