Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
COMPSCI 225-002 Introduction to Computer Science II (Fall 2011)
Programming Assignment #4, Due on 10/11/2011, Tuesday (11PM)
Introduction:
This assignment will ask you to implement a Queue ADT using two stack instance variables s1 and
s2. Please use TwoStackQueue to name your Queue class. The class should implement at least the
following Queue methods:
• public boolean offer(E item)
• public E remove()
• public E poll()
• public E peek()
• public E element()
• public Iterator iterator()
// return an iterator object that can iterate through
// the queue (in the order of data items to be deQueued).
The detail description of the above methods can be found in JAVA’s Queue interface, or check the
Table 4.1 on page 198 of our Textbook. At the beginning of your TwoStackQueue class, you should
import java.util.Stack so that you can declare two instance variables:
Stack s1, s2;
A TestTwoStackQueue program will be given in the directory
∼jhyeh/cs225/lab/p4/files
Description:
Copy the files TestTwoStackQueue.java and expected output from ∼jhyeh/cs225/lab/p4/files in
onyx to test your TwoStackQueue implementation.
Submission:
Submit your program from onyx by copying all of your java files to an empty directory (with no
subdirectories) and typing the following FROM WITHIN this directory:
submit jhyeh cs225 4