1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Juli2301 [7.4K]
3 years ago
5

Write java code that displays all the objects in a stack in the order in which they were pushed onto it. after all the objects a

re displayed, the stack should have the same contents as when you started. files to be submitted: taskademo.java arraystack.java stackinterface.java
Computers and Technology
1 answer:
kolbaska11 [484]3 years ago
7 0
Let's assume you have a stack called "s".
You can very simply print each element out using a for each loop (the iterable (as shown below), or a classic for each loop, if you prefer). This method does not modify the stack in any way.

s.forEach(System.out::println);
You might be interested in
Write a Dice Game program that generates two random dice values between 1 and 6 for you, and 2 for the computer. You get to roll
charle [14.2K]

Answer:

#include <iostream>

#include <time.h>

#include <string>

using namespace std;

int main(){

srand(time(NULL));

cout<<"Throw dice"<<endl;

int b =0;

int a=0;

a=rand()%6;

b=rand()%6;

for (int i =0;i<1;i++)

{cout<<"dice one: "<<a<<endl;}

for (int i =0;i<1;i++)

{cout<<"dice two: "<<b<<endl;}

if(a>b)

{cout<<"first dice won"<<endl;}

if(b>a)

{cout<<"second dice won"<<endl;}

else{cout<<"they are same"<<endl;

return main();

}

return 0;

}

Explanation:

/*maybe it help you it is almost done*/

6 0
2 years ago
PLEASE HELPPPPPPP What should you always disconnect before installing hardware inside a computer’s case?
Ad libitum [116K]

Answer:

a) all cabling hope it helps

3 0
2 years ago
How did The Gates by Christo and Jeanne-Claude affect the site?
Nadusha1986 [10]

Answer:

C. The experience of the park with The Gates was so different that some people saw the park in a new way.

Explanation:

The couple, Christo Javacheff and Jeanne-Claude Denat based in New York were two top contemporary artists who formed collaborative arts.

On the 3rd of January, 2005 they both made an art work known as The Gates, in Central Park.

The experience of the park with "The Gates" was so different that some people saw the park in a new way.

8 0
3 years ago
Read 2 more answers
What is the purpose of the product backlog refinement
BigorU [14]

Answer:

A

Explanation:

6 0
3 years ago
Read 2 more answers
A programmer is writing a program that is intended to be able to process large amounts of data. Which of the following considera
Dmitry [639]

Answer:

B. How many programming statements the program contains

Explanation:

If a program is intended to be able to process large amounts of data, then the ability of the program to process larger data sets is heavily affected by

  • execution time
  • size of memory the program requires
  • storage space the program requires as it runs.

The length of the statements the program contains does not much affect program performance.

8 0
3 years ago
Other questions:
  • Consider the following classes:
    8·1 answer
  • Describe encryption at gateways in thePresentation layer of the OSI Reference Model
    6·1 answer
  • What lie does E.D. tell to keep the musical from being canceled? There is a television crew coming to do a story on it. Jake wil
    6·1 answer
  • I need help with some computer stuff
    8·1 answer
  • What best describes "broadband access"? a. broadband access is a specific term used to describe the delivery of one-way televisi
    5·1 answer
  • I'm 11, except my profile says I'm 15.
    15·1 answer
  • The region which satisfies all of the constraints in graphical linear programming is called the:
    8·1 answer
  • Whats yall favv scary movie
    11·1 answer
  • A researcher is interested in learning more about the different kinds of plants growing in different areas of the state she live
    8·1 answer
  • Design algorithm and the corresponding flow chart for adding the subject score of 5, total value and rank.​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!