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
Tcecarenko [31]
3 years ago
8

Populate a stack with ten random integers and empty it by showing that the order of the elements is reversed, from last to first

.
CODE IN JAVA.

Thanks a Lot!
Computers and Technology
1 answer:
Anuta_ua [19.1K]3 years ago
4 0

Answer:

class Main {  

 public static void main(String args[]) {

   Deque<Integer> stack = new ArrayDeque<Integer>();

   Random rand = new Random();

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

       int n = rand.nextInt(100);

       System.out.printf("%02d ", n);

       stack.push(n);

   }

   

   System.out.println();

   

   while(stack.size() > 0) {

       System.out.printf("%02d ", stack.removeFirst());

   }

 }

}

Explanation:

example output:

31 18 11 42 24 44 84 51 03 17  

17 03 51 84 44 24 42 11 18 31

You might be interested in
HELPPPP MEEEE!!!!! ITS LIFE OR MUERTEEE
garri49 [273]

The author uses the text structure of compare and contrast to show multiple signals.

<h3>What is Text structures?</h3>

This is a term that connote the method used by authors to put together information in text.

Note that in the case above, The author uses the text structure of compare and contrast to show multiple signals.

Learn more about text structure from

brainly.com/question/12053427

#SPJ1

8 0
2 years ago
having your online class there's a lot of hazards and risk you may encounter while using gadget PC or Laptop whar do you usually
Anastaziya [24]
Unsure that if your visiting a site, that it is a secure website or don't download anything unless you know for sure that it is safe
5 0
3 years ago
The border that defines the outer boundary of a shape or other object
Over [174]
The answer is outline
8 0
3 years ago
Write a C++ Programm in which inheritance is used
geniusboy [140]

Answer:

// C++ program to demonstrate inheritance

#include <iostream>

using namespace std;

// base class

class Animal {

  public:

   void eat() {

       cout << "I can eat!" << endl;

   }

   void sleep() {

       cout << "I can sleep!" << endl;

   }

};

// derived class

class Dog : public Animal {

  public:

   void bark() {

       cout << "I can bark! Woof woof!!" << endl;

   }

};

int main() {

   // Create object of the Dog class

   Dog dog1;

   // Calling members of the base class

   dog1.eat();

   dog1.sleep();

   // Calling member of the derived class

   dog1.bark();

   return 0;

}

8 0
3 years ago
In which of the following phases of filmmaking would a production team be focused on the process of casting?
Rzqust [24]

Explanation:

There are five phases of film production and they include development, pre-production, production, post-production and distribution.

3 0
3 years ago
Read 2 more answers
Other questions:
  • What is the role of the constructor for an object?
    5·1 answer
  • Libby wrote an email to her friend. She pressed Shift and the number key 2 together to enter the email address. Which symbol did
    7·2 answers
  • Which of the following statements is true of ASCII code?
    12·1 answer
  • Using a cell phone while operating a motor vehicle is considered distraction because
    8·1 answer
  • When Web users enter the URL www.CIWcertified.com in their browser address bar, they can access the official CIW Web site at the
    6·2 answers
  • So, I have strict parents &amp; need help, if u don’t know how to fix this after u read it, leave. I don’t want u getting points
    11·2 answers
  • Please help I really need it
    7·1 answer
  • Where on the internet can you find a site that will allow you to tour bill gates mansion
    8·2 answers
  • Is a collection of information stored under a single nam​
    6·2 answers
  • when you sent email your email can be set to automatically keep a copy where do you find these copies​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!