Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1st Class:: public class Link { public int iData; public double dData; public Link next; public Link(int id, double dd) { iData=id; dData=dd; } public

1st Class::

public class Link {

public int iData;

public double dData;

public Link next;

public Link(int id, double dd)

{

iData=id;

dData=dd;

}

public void displayLink()

{

System.out.print("{" +iData +"," + dData +"}");

}

}

---------------------------------------------------------------

2nd Class::

public class LinkList {

private Link first;

////////////////////////////////////////////

public LinkList() //constructor

{

first= null;

}

////////////////////////////////////////////

public boolean isEmpty()

{

return(first==null);

}

///***Write here the insertFirst Method ***//

/////** write here the find Method ***/////////

///***Write here the deletFirst Method ***//

//////write here the delete Method any position**/////

///***Write here the display Method ***//

}

--------------------------------------------------

3rd Class(main)::

public class LinkListApp {

public static void main(String[] args)

{

LinkList theList = new LinkList(); // create list

theList.insertFirst(22,2.99);

theList.insertFirst(44, 4.99);

theList.insertFirst(66,6.99);

theList.displayList();

////////////////////////////

Link f= theList.find(44);

if(f != null)

System.out.println("Found link with key" + f.iData);

else

System.out.println("Can't find link");

////////////////////

Link d= theList.delete(66);

if(d != null)

System.out.println("Deleted link with key" + d.iData);

else

System.out.println("Can't delete link");

///////////////////////

theList.displayList();

}// end main

}//end class

-------------------------------

The question is ::

Update the code to perform the followings:

Take the inputs from user to enter data of linklist

insertFirst Method ()

deleteFirts Method ()

find Method () // search key taken from user

delete any position Method() // delete spicific key taken from user

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

Visual C# And Databases

Authors: Philip Conrod, Lou Tylee

16th Edition

1951077083, 978-1951077082

More Books

Students also viewed these Databases questions

Question

Comment should this MNE have a global LGBT policy? Why/ why not?

Answered: 1 week ago