Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java Question: Hi, I am currently a Queue Simulator for an email server. I tried converting my Queue Array to an ArrayList then changing
Java Question:
Hi, I am currently a Queue Simulator for an email server. I tried converting my Queue Array to an ArrayList then changing my codes to be able to use ArrayList. But I am unsure whether I did them correctly or not and also, I am also unsure of how to change my code in the QueueRunner() method to be able to use ArrayList.
Below is the screenshot of the changes I made:
// Global Variables. private static int maxSize; // private static int qArray []; // Added this. private static ArrayList qArray = new ArrayList (); private static int front; private static int rear; private static int nItem; = 0; private static double arrivalRate = 0; private static double messagesSent private static double messagesQueue private static double requeued = 0; private static int minutes = 0; private static ArrayList message = new ArrayList (); private static int total = 0; // Constructor. public QueueSim(int qSize) { } maxSize = qSize; // qArray = new int[qsize]; // Added this. qArray = new ArrayList (qSize); = front 0; rear = -1; nItem = 0; 0;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
To convert your queue implementation from using an array to using an ArrayList you need to make seve...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started