COP2250 Assignment 6
Due Wednesday, 6/18 at 6 am.
If you did not do Assignment 3, then create a NetBeans project that will
contain all of your homework projects for the rest of the course:
Project for Assignments.
Create a package for chapter 9 and create one main class in it
Import the main class into the Menu
class. This is the class
that is in the username
package of your assignment project.
Assignment Menu
Modify the menu in the main method of the Menu
class
(or create it if you did not do Assignments 3, 4 and 4).
-
Add an option for this program.
Student Class
Write a class encapsulating the concept of a student.
-
Place the class in the package for chapter 9.
-
A student will have the following instance variables:
-
a String, representing the name of the student.
-
a String, representing the id of the student.
-
an ArrayList of Integer objects, representing the exam grades for the student.
-
an ArrayList of Double objects, representing the assignment grades for the
student.
-
Create a default contstructor.
-
Create a constructor that has arguments of the name and the id.
-
Create accessors and mutators for the name and id.
-
Create an equals method, that will only compare the id.
-
Create a toStringExams method that will return a string that contains
all the exams in one line.
-
Create a toStringAssignments method that will return a string that
contains all the assignments in one line.
-
Create a toString method that will return the name, id, exams
and assignments in an easy to read string.
-
Create a method that returns the total of all the exams.
-
Create a method that returns the total of all the assignments.
-
Create a method that returns the number of exams.
-
Create a method that returns the number of assignments.
-
Create a method that returns the average of the exams.
-
Create a method that returns the average of the assignments.
-
Create a method that adds an integer to the list of exams.
-
Create a method that adds a double to the list of assignments.
Student Client Class
Write a main method that will test the class that you have created.
-
Test each method in each class.
-
Provide plenty of English in the output so that I can understand what is
being displayed.
-
Make the following tests.
-
Create an object using the default constructor.
-
Display the object.
-
Set the name.
-
Set the id.
-
Display the object.
-
Add 5 exam scores to the student.
-
Add 6 assignment scores to the student.
-
Display the student.
-
Display the total of the exams.
-
Display the total of the assignments.
-
Display the count of the exams.
-
Display the count of the assignments.
-
Display the average of the exams.
-
Display the average of the assignments.
-
Create a new object using the contstuctor that takes the name and id. Use
a different id.
-
Display the object.
-
Display whether the two objects are equal (they should not be).
-
Set the id of the second object to the same as the first object.
-
Display whether the two objects are equal (they should be).
-
Display whether the first object equals a string.
-
Display whetehr the first object equals null.
Submit Homework
To hand in the assignment, upload the JAR file online:
Submitting
homework on-line via the Web.
-
Upload the file as binary.
-
Be sure that the JAR file contains the .java files. Check this page for more
information: Submitting JAR Files