Question: home / study / engineering / computer science / computer science questions and answers / write a class called course_xxx that represents a course taken

home / study / engineering / computer science / computer science questions and answers / write a class called course_xxx that represents a course taken at a school. represent each ...

Your question has been answered

Let us know if you got a helpful answer. Rate this answer

Question: Write a class called Course_xxx that represents a course taken at a school. Represent each studen...

Write a class called Course_xxx that represents a course taken at a school. Represent each student using the Student class from the Chapter 7 source files, Student.java. Use an ArrayList in the Course to store the students taking that course. The constructor of the Course class should accept only the name of the course. Provide a method called addStudent that accepts one Student parameter. Provide a method called roll that prints all students in the course. Create a driver class School_xxx with a main method that creates a course, adds several students, and prints a roll.

Submit School_xxx.java and Course_xxx.java where xxx are your initials.

Student.java

//******************************************************************** // Student.java Author: Lewis/Loftus // // Represents a college student. //********************************************************************

public class Student { private String firstName, lastName; private Address homeAddress, schoolAddress;

//----------------------------------------------------------------- // Constructor: Sets up this student with the specified values. //----------------------------------------------------------------- public Student(String first, String last, Address home, Address school) { firstName = first; lastName = last; homeAddress = home; schoolAddress = school; }

//----------------------------------------------------------------- // Returns a string description of this Student object. //----------------------------------------------------------------- public String toString() { String result;

result = firstName + " " + lastName + " "; result += "Home Address: " + homeAddress + " "; result += "School Address: " + schoolAddress;

return result; } }

Please include commentary/documentation for me to better understand the code. Thank you!

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!