Homework: Queue Implementation on Sequence


This homework is necessary preparation for the lab. Make sure you type your answers in files you bring to the lab so that you will not have to waste time entering your code during the lab.

  1. Carefully review the partial skeleton for Queue3 where the Queue is represented as a Sequence.
  2. Complete the implementation of Queue3 on Sequence in the skeleton provided by writing bodies for the kernel methods: enqueue, dequeue, and length.
  3. Complete the body of the secondary instance method front defined in interface Queue. front is not a kernel method because it can be implemented on top of the existing kernel methods. Layer the implementation of front on the QueueKernel (and Standard and Iterable) methods as if you were writing it in QueueSecondary.
        /**
         * Reports the front of {@code this}.
         * 
         * @return the front entry of {@code this}
         * @aliases reference returned by {@code front}
         * @requires this /= <>
         * @ensures <front> is prefix of this
         */
        @Override
        public T front() {
            assert this.length() > 0 : "Violation of: this /= <>";
    
            // fill in body
    
        }
    

For the homework, turn in printouts of the completed Queue3.java file and of the code for method front.

Important!

You must complete these steps before coming to lab.

Starting with this lab you will be using a version control system to share your lab/project work with your teammate(s). For that to work from your computer you need to be able to establish a VPN connection to the COE network with the Ivanti VPN client. To do that you should install and configure the Ivanti VPN client on your own computer (Ivanti Secure VPN).

In addition, in this lab you will need to be able to establish an ssh connection to coelinux.coeit.osu.edu. If you are using a Windows computer, you should install an ssh client like Putty (https://www.chiark.greenend.org.uk/~sgtatham/putty/). If you are using a macOS or Linux computer you already have an ssh client you can access from a terminal window.

Furthermore, you need to have installed the Subclipse plugin as described in Downloading and Installing Plugins (steps 13-15). Without this plugin on your computer you will not be able to complete the lab and share your work with your teammate(s) in the future.

Finally, to prevent problems using Subclipse (SVN) in Eclipse on your Home computer, you need to visit the following web page and follow its instructions: https://cse22x1.engineering.osu.edu/2231/web-sw2/extras/instructions/environment-setup/home-vm-for-Eclipse-setup.html. (For CSE Lab computers, it is not necessary to follow these last instructions.)