Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8568539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:08:07+00:00 2026-06-11T18:08:07+00:00

I have an assignment that I am terribly lost on involving doubly linked lists

  • 0

I have an assignment that I am terribly lost on involving doubly linked lists (note, we are supposed to create it from scratch, not using built-in API’s). The program is supposed to keep track of credit cards basically. My professor wants us to use doubly-linked lists to accomplish this. The problem is, the book does not go into detail on the subject (doesn’t even show pseudo code involving doubly linked lists), it merely describes what a doubly linked list is and then talks with pictures and no code in a small paragraph. But anyway, I’m done complaining. I understand perfectly well how to create a node class and how it works. The problem is how do I use the nodes to create the list? Here is what I have so far.

public class CardInfo 
{
private String name;
private String cardVendor;
private String dateOpened;
private double lastBalance;
private int accountStatus;

private final int MAX_NAME_LENGTH = 25;
private final int MAX_VENDOR_LENGTH = 15;

CardInfo()
{

}

CardInfo(String n, String v, String d, double b, int s)
{
    setName(n);
    setCardVendor(v);
    setDateOpened(d);
    setLastBalance(b);
    setAccountStatus(s);
}

public String  getName()
{
    return name;
}

public String getCardVendor()
{
    return cardVendor;
}

public String getDateOpened()
{
    return dateOpened;
}

public double getLastBalance()
{
    return lastBalance;
}

public int getAccountStatus()
{
    return accountStatus;
}

public void setName(String n)
{
    if (n.length() > MAX_NAME_LENGTH)
        throw new IllegalArgumentException("Too Many Characters");
    else 
        name = n;           
}

public void setCardVendor(String v)
{
    if (v.length() > MAX_VENDOR_LENGTH)
        throw new IllegalArgumentException("Too Many Characters");
    else
        cardVendor = v;
}

public void setDateOpened(String d)
{
    dateOpened = d;
}

public void setLastBalance(double b)
{
    lastBalance = b;
}

public void setAccountStatus(int s)
{
    accountStatus = s;
}

public String toString()
{
    return String.format("%-25s     %-15s     $%-s     %-s     %-s",
            name, cardVendor, lastBalance, dateOpened, accountStatus);
}
}

public class CardInfoNode 
{
CardInfo thisCard;

CardInfoNode next;
CardInfoNode prev;

CardInfoNode()
{

}

 public void setCardInfo(CardInfo info)
 {
     thisCard.setName(info.getName());
     thisCard.setCardVendor(info.getCardVendor());
     thisCard.setLastBalance(info.getLastBalance());
     thisCard.setDateOpened(info.getDateOpened());
     thisCard.setAccountStatus(info.getAccountStatus());
 }

 public CardInfo getInfo()
 {
     return thisCard;
 }


 public void setNext(CardInfoNode node)
 {
     next = node;
 }

 public void setPrev(CardInfoNode node)
 {
     prev = node;
 }

 public CardInfoNode getNext()
 {
     return next;
 }

 public CardInfoNode getPrev()
 {
     return prev;
 }
}

public class CardList
{
CardInfoNode head;
CardInfoNode current;
CardInfoNode tail;

CardList()
{
    head = current = tail = null;
}


public void insertCardInfo(CardInfo info)
{
    if(head == null)
    {
        head = new CardInfoNode();
        head.setCardInfo(info);
        head.setNext(tail);
        tail.setPrev(node) // here lies the problem. tail must be set to something
                               // to make it doubly-linked. but tail is null since it's
                               // and end point of the list.
    }

}


}

Here is the assignment itself if it helps to clarify what is required and more importantly, the parts I’m not understanding. Thanks
https://docs.google.com/open?id=0B3vVwsO0eQRaQlRSZG95eXlPcVE

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T18:08:08+00:00Added an answer on June 11, 2026 at 6:08 pm
    if(head == null)
        {
            head = new CardInfoNode();
            head.setCardInfo(info);
            head.setNext(tail);
            tail.setPrev(node) // here lies the problem. tail must be set to something
                                   // to make it doubly-linked. but tail is null since it's
                                   // and end point of the list.
        }
    

    the above code is for when u not have any nodes in list, here u r going to add nodes to ur list.I.e. ist node to list
    here u r pointing head & tail to same node

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an assignment that requires us to implement a doubly linked list class.
I have an assignment that is supposed to be written in C (not C++),
For a school assignment I have to create a C++ program that will create
I have an assignment in which I need to create a function that tells
I have an assignment that asks me to retrieve delimited text from form values.
I have a homework assignment that I am supposed to write a http server
I have an assignment that I have to create a randomly sized 3D array,
I have an assignment that I'm supposed to implement the MIPS processor in C++
hey guys, i have a c++ programming assignment that asks me to create a
I have an assignment that converts dates from one calendar system to another. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.