Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

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

Data Mining Concepts And Techniques

Authors: Jiawei Han, Micheline Kamber, Jian Pei

3rd Edition

0123814790, 9780123814791

More Books

Students also viewed these Databases questions

Question

What is focal length? Explain with a diagram and give an example.

Answered: 1 week ago

Question

What is physics and how does it apply in daily life?

Answered: 1 week ago

Question

2. What type of team would you recommend?

Answered: 1 week ago