Return a reverse queue

Assignment Help JAVA Programming
Reference no: EM13165756

 represent my queue object as a parameter, It should return a reverse queue. it is suppose to take as a parameter an object of type Queue, the queue class defined in the algs13 package, and that returns aQueue object with the same elements as in the parameter queue but reversed. For instance, if the queue q1 contains the integer values 13, 15, 9, 10, and 25 (in that order), the following call:

q2 = reverseQueue(q1); 

will result in q2 having the values 25, 10, 9, 15, 13 (in that order). I am just confused about how I should represent the parameter as a Queue. Here is what I dug up so far:

 

 

import algs13.Queue;

 

public class reverseQueue {

public static int[] readInts()

{

Queue <Integer> q = new Queue<Integer>();

int N = q.size();

int[] a = new int[N];

for(int i = 0; i < N; i++){

final int temp =

 

 

Reference no: EM13165756

Questions Cloud

The standard reduction potentials to find the equilibrium : Use the standard reduction potentials to find the equilibrium constant for the following reaction at 25 degree Celcius:
A program that reads a four-digit number from the keyb : Write a program that reads a four-digit number from the keyboard as a string and then converts it into decimal. For example, if the input is 1100, the output should be 12. Hint: Break the string into characters and then convert each character to a va..
Where are wlan technologies going in the future : Where are WLAN technologies going in the future? Research what the next versions of the 802.11 standards are, and provide your educated opinion on how these technologies will be used.
Equilibrate with an atmosphere containing carbon dioxide : If the aqueous solution in the above problem with ammonia was also allowed to equilibrate with an atmosphere containing 10 3.5 atm carbon dioxide
Return a reverse queue : represent my queue object as a parameter, what the program should be doing. It should return a reverse queue
Compute the correct number of square feet needed : The Carpet House owner wants to put a carpet calculator on his website so that visitors can estimate the amount of carpet they will need to purchase.
State the spectrum of the hydrogen atom : What is the wavelength (in nm) of the line in the spectrum of the hydrogen atom that arises from the transition of the electron from the orbital with n =3 to the orbital
State high pressure stabilize the cscl form : Would applying a high pressure stabilize the CsCl form, or the NaCl form of this compound? (hint: calculate the volume per formula unit)
Write a program to create an invoice form for an order. : Write a program to create an invoice form for an order. After the data on the left side of Fig. 5.27 is entered, the user can display an invoice in a list box by pressing the Process Order button. The user can click on the Clear Order Form button to ..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Achieve these two important features

Java TM is a portable language, and being an object-oriented programming language, it also encourages component reusability. How does Java TM achieve these two important features

  Create a recursive factorial program

Assignment 1: Create a recursive factorial program that prompts the user for an integer  N  and writes out a series of equations representing the calculation of  N !. For example, if the input is 4, the output could be:

  Point of sale terminal

a software implementation of a Point of Sale terminal at a typical store. The users of the system are the cashiers sitting at the sales terminals of the store. The users can use the system to manage sales items in the store, customer details and of c..

  Classes and pointers experience using dynamic memory

To practice defining classes using separate compilation using classes, vectors, and pointers experience using dynamic memory.

  Design an application for pizza order process

Create an application to take and procedure a pizza order. The user should be able to make pizza order choices from listboxes, and the application should show the order price.

  Develop java package comprising of class using encapsulation

Develop the Java package comprising of Class and Student with the given requirements. Encapsulation, Method to print student details alone.

  You must also do the work of sorting

You must also do the work of sorting in the method. You cannot just call another library method. Use loops to show the data in the original array as well as the repopulated array in ascending order.

  Determine the type of moped

Write a driver class called MopedRental. This class should perform the following: asks the user to enter the size of the moped, the day of the week and the number of hours rented, creates the Moped object, based on the size, and displays the input..

  Implement the application using a singly linked list

Implement the following application using a singly linked list. This application accepts from console and stores a list of 10 names of your friends in the singly linked list

  An api for a library that provides for all these operations

Quaternions can be represented with four (4) real numbers (a,b,c,d). They can be added, subtracted, multiplied and divided. You can multiply a quaternion by a scalar (which produces a quaternion as a result)

  Reads contents of two vectors

Write a program that reads contents of two vectors, and then displays the sum of these two vectors. The program should prompt the user to enter the size of the vectors first.

  Implement a shopping cart class with user interface

project will be to implement a shopping cart class with user interface (UI) that contains main() in Net Beans. The UI class will be used to perform user input/output and to invoke the appropriate methods of shopping cart class. When your program star..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd