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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. 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!.

  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.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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