0

I have put the instructions for this code and I have most of it done but i am getting errors. Not sure what is wrong. Also codin

Define the Student class to inherit from the Person class. Declare an int public class variable to represent the ID number. Do not make this variable private. Name this variable id. Write the constructor to initialize all class variables. The order of the Student constructor should be (firstName, lastName, id). Also, define the toString() method to resemble the toString() method from the Person class, except with the ID following the name. The format should resemble: Student: FirstName LastName ID Make sure to add a .equals(Object obj) method for Person, and Student. A student ID is unique, so students are equal if the ID is equal, along with their first and last names. For people, they are only unique/equal if both first and last names are equal. Step 2: Roster.initializeListFromFile() Now, complete the unfinished initializeListFromFile() in the Roster class. This method takes a filename as a parameter and fills the ArrayList of objects of type Person or Student. Each line in the file to read from represents a single object with the following possible formats: For a Student object: firstName lastName id For a Person object: firstName lastName We recommend using the String method .split() which returns an array of strings, to parse the line. Your method should loop through every line in the file, and add a new Person or Student object to the people ArrayList by calling the appropriate constructor with the appropriate arguments.

9th Nov 2021, 7:33 AM
Carlye
2 Respuestas
0
please put the code you have written so we can see the problem
10th Nov 2021, 12:15 PM
Murtada abed
Murtada abed - avatar