Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

NEED HELP WITH THIS QUESTION PROGRAMMING LANGUAGE : JAVA An alphabetically order

ID: 3843918 • Letter: N

Question

NEED HELP WITH THIS QUESTION

PROGRAMMING LANGUAGE : JAVA

An alphabetically ordered phone book application based on the use of a doubly linked list data structure will be developed. The application will also have a visual interface. n this context, we write Java code that meets the requirements detailed below. The name and surname of the persons and phone numbers are included in the guide. You can use a String variable of the form "namesurname" o represent the names and surnames of people. The person may have more than one phone number, so their phone numbers can be stored in an "ArrayList Define this information about people in a class named nfo n this way, in addition to the necessary bindings for the doubl nked n the node class of the list, a ariable st of type "Info" class will also be defined In your double linked list class, define 2 variables representing the list's head and ta In practice, the user should be offered the following options: 1) Reading from the text file named as below and guide.txt should be done in double linked list memory. (The data is separated by a com ma NOTE-1: The guide will be created in alphabetical order by name. When someone else by the same name comes in, they will be added in alphabetical order by surname. uide txt Alex Garrison, 0 533 1111111, 0 232 1111 111 Harry Kane, o 554 2222222, o 543 3333333, o 312 1111111 Jane Kubrick, 0216 444444

Explanation / Answer

Answers of 1,2,3,4 answers:

import java.util.NoSuchElementException;

public class DoublyLinkedListImpl<E> {

    private Node head;

    private Node tail;

    private int size;

                              

    public DoublyLinkedListImpl() {

        size = 0;

    }

    

    private class Node {

        E element;

        Node next;

        Node prev;

        public Node(E element, Node next, Node prev) {

            this.element = element;

            this.next = next;

            this.prev = prev;

        }

    }

    

    public int size() { return size; }

     

    public boolean isEmpty() { return size == 0; }

     

    public void addFirst(E element) {

        Node tmp = new Node(element, head, null);

        if(head != null ) {head.prev = tmp;}

        head = tmp;

        if(tail == null) { tail = tmp;}

        size++;

        System.out.println("adding: "+element);

    }

     

    /**

     * adding elements to the end of the list

     

     */

    public void addLast(E element) {

         

        Node tmp = new Node(element, null, tail);

        if(tail != null) {tail.next = tmp;}

        tail = tmp;

        if(head == null) { head = tmp;}

        size++;

        System.out.println("adding: "+element);

    }

     

    /**

     * walks forward through the linked list

     */

    public void iterateForward(){

         

        System.out.println("iterating forward..");

        Node tmp = head;

        while(tmp != null){

            System.out.println(tmp.element);

            tmp = tmp.next;

        }

    }

     

    /**

     * this is used for walks backward through the linked list

     */

    public void iterateBackward(){

         

        System.out.println("iterating backword..");

        Node tmp = tail;

        while(tmp != null){

            System.out.println(tmp.element);

            tmp = tmp.prev;

        }

    }

     

    /**

     * this is used for removes element from the start of the linked list

          */

    public E removeFirst() {

        if (size == 0) throw new NoSuchElementException();

        Node tmp = head;

        head = head.next;

        head.prev = null;

        size--;

        System.out.println("deleted: "+tmp.element);

        return tmp.element;

    }

     

    /**

     * this is used for removes element from the end of the linked list

     * @return

     */

    public E removeLast() {

        if (size == 0) throw new NoSuchElementException();

        Node tmp = tail;

        tail = tail.prev;

        tail.next = null;

        size--;

        System.out.println("deleted: "+tmp.element);

        return tmp.element;

    }

     

    public static void main(String a[]){

         

        DoublyLinkedListImpl<Integer> dll = new DoublyLinkedListImpl<Integer>();

        dll.addFirst(10);

        dll.addFirst(34);

        dll.addLast(56);

        dll.addLast(364);

        dll.iterateForward();

        dll.removeFirst();

        dll.removeLast();

        dll.iterateBackward();

    }

}

Answers of 5,6 answers:

import java.io.*;

  

import java.util.*;

  

  

  

class Alphabet

  

             {

  

                    public static BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in)); //Don't worry about this line. I'm going to do something with it later.    :-P      

  

                    public static void main(String[] args) throws IOException

  

                    {

  

                      System.out.println("Welcome to the alphabet program.");

  

                      System.out.println("This program will display the alphabet in ascending and descending sequence at the same time.");

  

                      System.out.println("");

  

                      System.out.println("");

  

                      System.out.println("");

  

                       

  

                      int ascending = 65;

  

                      int descending = 122;

                      char current = 0;

  

  

  

                      do

  

                      {

                         current = (ascending).ASCII; //Problem here!

  

                         System.out.print(current);

                         current = (descending).ASCII; //Problem here!

                         System.out.print(current);

                         System.out.print(" ");

  

                         ++ascending;

  

                         --descending;

  

                      }

  

                      while (ascending < 91);

  

                    }

  

             }