You are to simulate a line of people at the bank (a queue). The data structure you are to use for the queue is a linked list. The elements of each node in the linked list are:

  • Account number (integer)
  • Type of transaction (integer "d" for deposit, w for withdrawal)
  • Amount of transaction (double)
  • Link to previous person (pointer to the previous node)
  • Link to next person (pointer to the next node)

The linked list program stored on blackboard that implements a queue should be used to model this program. Remember, that with a queue, the first one will be processed (removed from the queue) and when you add to the queue, you add at the end of the queue. Therefore, with a queue, you MUST always keep track of the first and last node in the list.

Your program must contain a user defined class containing all of the following methods:

  • Method to create the line at the bank (create a first "dummy" link for the queue)
  • Method to add people and all related information to the line at the bank (add to the queue)
    • This routine will prompt for all information and add a new node containing the information as well as setting all necessary links
  • Method to send the next person in line to the teller (delete from the queue)
    • This routine will print all information of the first person in line. You will then delete this person from the line (delete from the queue). If there is no one in line (no nodes in the linked list) you are to print a message saying that there is no one in line
    • Accumulate the amounts processed (sent to teller and deleted from queue for deposits and withdrawals)
  • Method to print all information for all of the people in line at any given time
    • If there is no one in line (queue is empty) print a message saying the line is empty
    • If there are people in line, Print all information stored for each person
    • Print the count of the number of people in line
  • Method to print the final total of deposits and withdrawals processed
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.