Question: You are given the source code for class homework1523, that has the following: 1. object variable top, initialized to null, but later on should point

 You are given the source code for class homework1523, that has

You are given the source code for class homework1523, that has the following: 1. object variable top, initialized to null, but later on should point to the last data entered. 2. Method readData(), reads names from the user and stops when they enter the string stop. For this method you need to add the code, where indicated, so each name read is stored in a node and each node needs to be linked to the next one. you add each name a linked list, by using the inner class Node, and the object variable first, that will point to the last node entered. The nodes should be linked in the following format, if data "a", "b", "c" is read in the that order, then the nodes should be linked as follows: 3. Method pritnData(), should print all the data in the nodes starting from top. You need to write the body of this method 4. Method main() is done for you, it calls readData then calls printData. Here is a sample run of the program: Enter a student name or stop to end: shereef. Name: shereef Enter a student name or stop to end: omar Name: omar Enter a student name or stop to end: nadia Name: nadia Enter a student name or stop to end: stop Printing the data: nadia omar shereef - You can work with a partner, or individually. - To be done in class. - Put your name and your partners name as a comment in the first line of the file. - Upload your source code to moodle

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!