Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

answer this part only, please use java with screenshots included to undertand each step clearly(red part), you need to make from the top question,and then

answer this part only, please use java with screenshots included to undertand each step clearly(red part),

you need to make from the top question,and then provide me with the DoubleLinkedList because i have error image text in transcribed

import java.util.LinkedList;

public class MyDoubleLinkedList {

private DoubleNode front; private DoubleNode rear;

public void insertAtFront(T item) {

DoubleNode node = new DoubleNode(); node.setValue(item); node.setNext(front); if (front != null) { front.setBack(node); } if (front == null) { rear = node; } front = node; }

public void removeAtFront() { if (front == null) { System.out.println("Nothing to remove... Operation invalid..."); return; }

DoubleNode node = front.getNext(); if (node != null) { node.setBack(null); } if (node == null) { rear = null; } front = node; }

public void print() { System.out.println("List from front to end"); DoubleNode current = front; while (current != null) { System.out.println(current.getInfo()); current = current.getNext(); } }

public void printReverse() { System.out.println("List from end to front"); DoubleNode current = rear; while (current != null) { System.out.println(current.getInfo()); current = current.getBack(); } }

public LinkedList getList() {

LinkedList list = new LinkedList(); DoubleNode current = front; while (current != null) { list.add((T) current.getInfo()); current = current.getNext(); }

return list; }

}

MyDoubleLinkedList class

Exercise #2 Answer the following Question: 1. Given the following class public class DoubleNode private object info=null; private DoubleNode next=null; private DoubleNode back=null; 3 2. Complete the class DoubleNode by adding the necessary methods. 3. Create a class my Double Linkedlist similar to myLinkedList (created in the lecture) This class should have at least the following methods inserAtEronto. removeAtEconto print and printReverse Write a method that create a linked list from a double linked list using the methods available in myDoublelinkedlist and java.util.Linkedilist 4 5. Create a class named "Car" which has the following fields. The fields correspond to the columns in the text file except the last one. i Vehicle Name String 11. Engine Number String 1/2 Vehicle Price double IV. Profit double V. Total Price double (Total Price = Vehicle Price + Vehicle Price Profit/100) b) In Test class, write a method named showCat (myDoublelinkedlist list, String Numbet) takes the list and Engine Number as parameters, and displays all the information of the particular.cat including Total Price. -) In Test class, write the main method (in Test class) to 1 Create my Doublelinkeslist list 2. Read the content of the text file and for each row an instance of the class Car is created with the calculated Total Price (use My Doublxlinkedlist of objects) and add each instance list (in b.1). 3 Test the method showCaro 4. Test the methods written in max Doublelinkedlist

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

Databases DeMYSTiFieD

Authors: Andy Oppel

2nd Edition

0071747990, 978-0071747998

Students also viewed these Databases questions

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago