********below are the instructions for the code that needs to be completed. Fill
ID: 3908343 • Letter: #
Question
********below are the instructions for the code that needs to be completed. Fill in the ???? in the codes below****************
Create a Java program named List that contains the following: o a doubly linked list that contains data for an integer named ProductID and a string named ProdType o allow the list to be filled by reading data from a file (productdata.txt or prompt for filename) that contains records consisting of the two fields o create a 20 entry queue that can contains data for an integer named Transid and a character named Transtype o load the queue from a file (transactions.txt or prompt for filename) five records at a time or until end of file (i.e. throttle the input to process); o After all of the transactions are processed, print the entries from the linked list. o process the queue after each partial load: ? first print the entire queue (choose some symbol to print for empty members), ? then, for each transid, find the matching productid in the doubly linked list (transids will be in random order) ? print the entry for transtype 'P' ? delete the entry for transtype 'D' ? clear (null ) the transid after processing an entry o after all of the transactions are processed, print the entire linked list.
List Vars.java
public class ListVars
{
????? current = null; // Pointer to current record to process in Linked List
????? dllBegin = null; // Pointter to begining record of Linked List
????? dllEnd = null; // Pointter to last record of Linked List
int dllCount = 0; // Number of records in the Linked List
int transCt = 0; // Number of transactions in queue to be processed
int queAddNx = 0; // Next index position in queue to insert into next
int queProcNx = 0; // Next index position in queue to process
}
Record.java
public class Record
{
???? next = null; //Each record points to the NEXT record
???? prev = null; //Each record points to the Previous record
int productID = 0; //Each record has an integer id
String prodType= null;
}
Explanation / Answer
Answer:- For this question i don't able to understand whether i have to just remove the ???? mark and place the variable name which will be use or i have to write whole program. For now i am just removing ???? mark and pasting the solution. If you need whole solution kindly let me know.
public class ListVars
{
Record current = null; // Pointer to current record to process in Linked List
Record dllBegin = null; // Pointter to begining record of Linked List
Record dllEnd = null; // Pointter to last record of Linked List
int dllCount = 0; // Number of records in the Linked List
int transCt = 0; // Number of transactions in queue to be processed
int queAddNx = 0; // Next index position in queue to insert into next
int queProcNx = 0; // Next index position in queue to process
}
-------------------------------
public class Record
{
Record next = null; //Each record points to the NEXT record
Record prev = null; //Each record points to the Previous record
int productID = 0; //Each record has an integer id
String prodType= null;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.