Question: need help for java code and run completely(with comment) thanks! Classes and Objects You have already written a Java class to represent a class section

 need help for java code and run completely(with comment) thanks! Classesand Objects You have already written a Java class to represent aclass section for a course like SOC 300 but you must wonder,

need help for java code and run completely(with comment)

thanks!

Classes and Objects You have already written a Java class to represent a class section for a course like SOC 300 but you must wonder, what about the students who have enrolled in it? We'll take care of that now by creating another class called StudentEnrollee and adding an attribute of an ArrayList of this type to class section. Now the complete set of attributes will be 1.CRN: 10059 2. Department SOC 3.Course number 300 4.Instructional mode : Online 5. Meeting days N/A 6. Meeting times: N/A 7. Capacity 60 8. Enrollment: 60 9. Instructor's ID:122 10. Enrollee list (an ArrayList of student enrollees) We need to create a StudentEnrollee class which has these attributes Student ID grade (For simplicity let's use numbers like 4, 3, 2, 1 and 0.) We don't include student attributes like lastName, firstName, majorCode, etc. because we assume that the database designers have correctly designed these tables to eliminate redundancy. Therefore, they represent student in an enrollee list by its ID which points to a record in a separate student table that contains the complete set of student attributes Because these attributes, like most data attributes in object-oriented applications, are private they need setter and getter methods. They must also have a no parameter constructor, a constructor that accepts parameters for both attributes, and a toString method Once you've written the Java file for the StudentEnrollee class, you can add an ArrayList of student enrollees to the class section class. We use an ArrayList because it has the ability to expand to accommodate new elements, as opposed to an array which has a fixed size We declare ArrayLists this way List Class nameOfList = new ArrayList(optional number of elements) For instance, to create an empty ArrayList of objects of a class named Book: List Book> booklistnew ArrayList-Book>0 To create an ArrayList of objects of a Book class which can initially hold 10 Book objects

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!