Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

13:22 30 December Thu %95- Ims tedu.edu.tr 1 of 2 In this assignment, you will implement a linked list called MyLinkedList, which will store the

image text in transcribedimage text in transcribedimage text in transcribed

13:22 30 December Thu %95- Ims tedu.edu.tr 1 of 2 In this assignment, you will implement a linked list called MyLinkedList, which will store the nodes containing Person objects. The Person and Node classes are given below. MyLinkedList class: This class has Node type attribute start, it has a constructor which initializes the attribute start to null. It has add(Person) method, which inserts a Node into the linked list in the descending order of Person (look the compareTo method already implemented in Person class). It searches a proper place in the linked list and inserts the new node at that place. It has a printAll method, which prints all the Nodes. Person Class class Person implements Comparable{ String name; int birthYear; public Person(String name, int birthYear){ this.name = name; this.birthYear = birthYear; } public int compareTo(Person p2){ return (this.name).compareTo((p2.name)); } public String toString(){ return "name: + name + } Birth Year + birthYear; 13:22 30 December Thu %95- ims tedu.edu.tr 2 of 2 Node Class: class Node{ Person data; Node next; Node (Person d){ data = d; next = null; } } Driver Class: import java.util.*; public class LinkedlistDriver { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = Integer.parseInt(sc.nextLine()); MyLinkedList 11 = new MyLinkedList(); for(int i=0;i<>

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 Basic Net Database Programming

Authors: Rod Stephens

1st Edition

0789726815, 978-0789726810

More Books

Students also viewed these Databases questions