Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Java, use MyQueue.java This is the second time I'm posting this question, someone could not solve it and said 'add the text' however, this

In Java, use MyQueue.java

This is the second time I'm posting this question, someone could not solve it and said 'add the text' however, this is all we have as a homework.image text in transcribedimage text in transcribed

CodeZinger Dashboard> Classes> 2336.006 FIB>HWS P1 Queue using two stacks private int maxCepacity4 private Stack stack1; private Stack stack2: PyQueue.java MyQueueDriverjeve MyQueue.java 0 ava.util1. Note: You can use library Stack but you are not allowed to use library Queue and any of its methods 2 import java.lang. 3 import java.io. . .Your Queue should not accept null or empty String or space as an input 5 publie class Myoueue( You need to implement the following methods using two stacks (stack1 & stack2) and also you can add more methods as well: private int maxcapacity 4i private Stack atackli private Stack stack2 public int size) public vold insert String value) public String remove( private void shiftStacks) public boolean isEmptyo) public boolean isFull(O) 10public MyQueueO 12public int size) 13 14- public void insert (String value)t 15 16 public String reove) 17 18private void shiftstacks) 19 20public boolean isEapty) t 21 22public boolean isFull) 23 24 25 26public string tostring) 27 28 29 30 Test casel: Testing empty queue Inputi: Output1: [O:Empty:] Test case2: Testing insert method Input2: Output2: [4:Full:a, b, ,d eoverride Oueuesize:Full/Empty:QueueElementsList) Test case3: Testing remove method Input3: shiftstacks(i StringBuilder sbne StringBuilder( ") sb.append (this.size)).append("" if(this.isEmpty)) sb.append Empty") append("") sb.append( "Full.append: sb.append(this.remove 32 else if (this.isFull)) Output3: 3:b, c,d while(iiaEmpty(O) 34- 35 36 37 3 8 39 40 if(this.size!-0) sb.append(",'i sb.append(" return sb.tostring) 42

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

Database Machine Performance Modeling Methodologies And Evaluation Strategies Lncs 257

Authors: Francesca Cesarini ,Silvio Salza

1st Edition

3540179429, 978-3540179429

More Books

Students also viewed these Databases questions