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

  Technical community blog

Write a blog article for a coding and technical community blog.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Comparator that compares point objects by their distance

write a comparator that compares point objects by their distance from the origin of (0,0). points that are closer to the origin are considered to come before those which are further from the origin

  Statements to print a label

Add the statements to print a label in the following format (the numbers in the example output are correct for input of $4.25 per pound and 41 ounces). Use the formatting object money to print the unit price and total price and the formatting object ..

  Program that initializes an array with ten random integers

Write a JAVA program that initializes an array with ten random integers and then prints four lines of output, containing

  Write a java program to compute salary

Write a Java program which computes the Salary for a given number of employees. The program prompts user to enter n the number of employees.

  Create a gui version of the game mini sudoku.

Each row has the numbers 1 to 6,Each column has the numbers 1 to 6,Each group of 2 rows by 3 columns also has the numbers 1 to 6.

  Write a program to track hourly employee arrival departure

THE JAVA SOURCE CODEWILL AWARD AN ADDITIONAL 1,500 POINTS TO PERSON WITH THE BEST ANSWER (you will be directed to another one of my previous, unanswered questions.)A company hires you to write a program to track hourly employee arrival and departure ..

  Demonstrates conditions under which the compareto() method

Write an application that demonstrates conditions under which the compareTo() method retrun a positive number, a negative number, and a zero when used to compare two Strings, Save the file as CompareStringValues.java. Lab Assignment

  Modify the scholarship application

Modify the Scholarship application so that if a user enters a grade point average under 0 or over 4.0, or a negative value for either of the activities, an error message appears.

  You need to train for 10 weeks

You are preparing for a marathon. In order to prepare, you need to train for 10 weeks, running an increasing number of miles per week, starting at running at least 2 miles your first week up to 26 miles by week 10.

  Robot preparing for competition

Create an event so that the skateboard can be controlled by game player

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