Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Java class beneath characterizes a line information structure with a proper limit. public class FixedCapacityQueue { int[] mData = invalid; int mHead=0;//record of first


The Java class beneath characterizes a line information structure with a proper limit. public class FixedCapacityQueue { int[] mData = invalid; int mHead=0;//record of first full cell int mTail=0;//file of next void cell public FixedCapacityQueue(int limit) { mData = new int[capacity]; } public boolean enqueue(int x) { if (mTail==mData.length) get back bogus; mData[mTail]=x; mTail++; bring valid back; } public int dequeue() { on the off chance that (mTail==mHead) return - 1; int v=mData[mHead]; mHead++; bring v back; } } (a) Explain the dangers presented by the absence of access modifiers indicated on the state. Which access modifier is fitting for these substances? [3 marks] (b) Discuss the decision to flag enqueue and dequeue blunders utilizing return upsides of misleading and - 1, individually. Propose a superior other option and alter enqueue and dequeue to utilize it. [5 marks] (c) Explain how an enqueue procedure on a FixedCapacityQueue item could fizzle with a mistake in any event, when there are less things in the line than the appointed limit of the article. Tell the best way to fix this. [3 marks] (d) Rewrite the class to utilize Java's Generics with the goal that it tends to be utilized to address lines of inconsistent items (Integers, Strings, and so forth) Utilize the java.util.ArrayList class rather than int[] for the kind of mData

imageimage

P17. In Figure 5.13, consider the path information that reaches stub networks W, X, and Y. Based on the information available at W and X, what are their respective views of the network topology? Justify your answer. The topology view at Y is shown below. WA C X SOCKET PROGRAMMING ASSE Stub network Y's view of the topology Y

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Computer Network questions