Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 24th International Conference Dexa 2013 Prague Czech Republic August 2013 Proceedings Part 1 Lncs 8055

Authors: Hendrik Decker ,Lenka Lhotska ,Sebastian Link ,Josef Basl ,A Min Tjoa

2013 Edition

3642402844, 978-3642402845

More Books

Students also viewed these Databases questions

Question

Compare Web 2.0 and Web 3.0.

Answered: 1 week ago