Create a class that uses the genetricstack class

Assignment Help JAVA Programming
Reference no: EM13708697

Question: Create a new class named GenericStack that specifies a type variable that gives for generics.

Declare a LinkedList that hold the elements in the stack. Then use the LinkedList to implement the methods shown above.

Create a class that uses the GenetricStack class

Call the class GenericStackApp. Declare a generick stack at the beginning of the main method that will store String Objects.

Include code to the main method that uses the push method to include at least three items to the stack. After each item is added, display its value at the console (you'll need to use a string literal to do this).

Then, use the size method to return the number of items in the stack and display that value.

Use the peek method to return the first item and show that item, and use the size method to return the number of items again and show that value.

Use the pop method to return each item, displaying it as it's returned, and show the number of items one more time.

Display:

Push: Apples

Push: Oranges

Push: Bananas

The stack contains 3 items

Peek: Bananas

The stack contains 3 items

Pop: Bananas

Pop: Oranges

Pop:Apples

The stack contains 0 items

I am having difficulty with this problem because I do not know where to start with.

Reference no: EM13708697

Questions Cloud

Computes the product of all elements in a vector : Write a C function that computes the product of all elements in a vector x of dimension n. The elements of the vector are stored in a double array of size n.
How much of each solution should be mixed to prepare buffer : Question- You need to prepare 100 ml of a pH = 4.00 buffer solution using 0.100 M Benzoinc acid (pka = 4.20) and 0.120 M sodium benzoate. How much of each solution should be mixed to prepare this buffer
Prepare a c function that returns the number of elements : Prepare a C function that returns the number of elements smaller than 3.0 in an array - make a function returns the number of elements.
What is the volume occupied by argon gas at a pressure : Question- What is the volume occupied by 22.3g of argon gas at a pressure of 1.48atm and a temperature of 469K. Express your answer with the appropriate units.
Create a class that uses the genetricstack class : Create a new class named GenericStack that specifies a type variable that gives for generics - Use the peek method to return the first item and show that item, and use the size method to return the number of items again and show that value.
The formal charges of all atoms in the correct structure : Question- Write Lewis structure that obeys the octet rule for OCS and assign formal charges to each atom. Draw the molecule by placing atoms on the grid and connecting them with bonds. Include all lone pairs of electrons. Show the formal charges o..
Binary search algorithm : How many elements must be compared to search a list of 20,000 elements using the binary search algorithm - What will this statement do?
What is the final state of hydrogen atom : Question- A ground-state hydrogen atom absorbs a photon of light that has a wavelength of 97.2 nm. It then gives off a photon that has a wavelength of 486nm. What is the final state of hydrogen atom
Draw an eer diagram with the given entities : Draw an EER Diagram with the given entities with the attributes listed - implement EER Diagram.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write java program that calculates total order for customer

Write a Java program that calculates the total order for a customer. The order should include the details of buying several products. For each product (item), there should be a product code, product price, product description, and product icon.

  Create a secure parts inventory catalog system

You will create a secure Parts Inventory Catalog system using Model 2 architecture. The application will require a user to have the proper access right to enter the system, and when satisfied, presents the catalog of items currently available in t..

  What is a java archive

What type of output does the javadoc command generate and how do you view the output and what is a Java archive?

  String copy and string concatenation functions

Write the string copy and string concatenation functions -  Append n characters from string2 to stringl by using pointer arithmetic

  Part-2write a program that will perform some of the basic

part-2write a program that will perform some of the basic tasks accomplished by a file integrity checker such as

  Determines and displays the smallest and largest

Create a method that determines and displays the smallest and largest of the ten values. Then, pass the array to the method - Create a GUI application whose button's Click() method accepts ten integer values from a TextBox and stores them in an arra..

  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.

  Write a test application name employeetest

Create two Employee objects and display each objects yearly salary. Then give each employee a 10% raise and display each employee's yearly salary again.

  Write an algorithm for fining the middle node

Write an algorithm for fining the middle node of a doubly linked list given both the head and the tail of the list.And Write a  recursive  java function that counts the number of nodes in a circularly linked list.

  Question a jsp expression can contain any java expression

question a jsp expression can contain any java expression that evaluates to aa string objectb java objectc primitive

  Write java program to display results in java applet

Write down the java program which displays following results in java applet. Permits the user to enter three numbers (use JOptionPane for this) and prints out average of those value on screen.

  Write a java program to perform matrix multiplication

Write a java program to perform matrix multiplication - Your code will need to be able to read in these files, place the contents of each file into separate two-dimensional arrays and then perform the needed multiplication and place the output of t..

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