Answered step by step
Verified Expert Solution
Link Copied!

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:

image text in transcribed image text in transcribed image text in transcribed 

// 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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Introduction To Data Structures And Algorithm Analysis Java Edition

Authors: Clifford A. Shaffer

1st Edition

0136609112, 978-0136609117

More Books

Students also viewed these Programming questions

Question

Compute Paasches index for 2013 using 2000 as the baseperiod.

Answered: 1 week ago