Question: I only need answer for D. thanks Q 1. Implement the following in Java: a Create a data type Person with three string fields: firstName,

I only need answer for D. thanks  I only need answer for D. thanks Q 1. Implement the
following in Java: a Create a data type Person with three string

Q 1. Implement the following in Java: a Create a data type Person with three string fields: firstName, lastname and id. The field id is unique to each person. Add accessor methods, a constructor with three parameters, and the toString() method. b Within the main() program, instantiate a linked list (use the Java LinkedList class). Write the following functions(methods) that the main program will invoke all these will be static methods of the main class): store (, ) that reads the data for several persons from the input stream and stores the data in the linked list. display (output stream>, ) that writes the data for all person ob- jects in the linked list, on the output stream, one per line. find(string sid, ) that returns the index of the person object in the linked list, that has the same id value as sid (return -1 if no such person exists). This can be done as a simple search that goes sequentially through all the objects in the linked list. Create a data file with data for a few person objects. In the main method, call the store) and display() methods to read the data and display it. Invoke the find method a few times. Compile and test your code. c Construct a different version of the above program as follows: (1) create a data type Personlist that uses the Java Linkedlist, and supports the methods(re- written appropriately) from part b. (2) instantiate the PersonList object in the main program and invoke its methods (as per the appropriate syntax), so that program produces the same output as the one in part b. 1 d (Individual Reflection) Which of the two versions (part b and part c), in your opinion, repre- sents a process-centered approach? Which one represents a data-centered approach? What additional features, in your opinion, if added to the LinkedList class might reduce the coding effort in part c? Justify all your claims

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!