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
Paha777 [63]
3 years ago
10

Create a stack with three integers and then use .toarray to copy it to an array.

Computers and Technology
1 answer:
Marizza181 [45]3 years ago
6 0

Answer:

import java.util.*;

import java.lang.*;

import java.io.*;

class Codechef

{

public static void main (String[] args)

{

    Stack<Integer> mat=new Stack<Integer>();

    mat.add(1);

    mat.add(3);

    mat.add(6);

    System.out.println(mat);

    Object [] a=mat.toArray();

    for(int i=0;i<a.length;i++)

    System.out.println(a[i]);

}

}

Explanation:

An integer type stack st is created;

1,3 and 6 are added to the stack.

printing the contents of the stack.

array a is created form the stack using toArray().

Then printing the array.

You might be interested in
Text that is heavier or darker than other text in the document is considered _____.
kvv77 [185]

The text that is heavier or darker than other text in a document is considered  Bold.

Hope this helped!~

7 0
3 years ago
Read 2 more answers
Write a program that accepts three decimal numbers as input and outputs their sum​
Sophie [7]

Answer:

sum = 0.0

for i in range(0,3):

   sum += float(input("Enter a decimal number to sum: "))

print ("Sum: ", sum)

*** Sample Input ***

Enter a decimal number to sum: 1.1

Enter a decimal number to sum: 2.2

Enter a decimal number to sum: 3.3

*** Sample Output ***

Sum:  6.6

Explanation:

For this problem, a method was devised in python to create the sum of three individual decimal numbers.

The first line of code, <em>sum = 0.0</em>, initializes a variable to the float type in which we will store the value of our sum.  Note, it is initialized to 0.0 to start from a value of 0 and be considered a float.

The second line of code, <em>for i in range(0,3):</em>  is the creation of a for loop control structure.  This will allow us to repeat a process 3 amount of times using the iterator i, from value 0 to 3 in this case.  Note, 0 is inclusive and 3 is exclusive in the python range.  This means the for loop will iterate with, i=0, i=1, and i=2.

The third line of code, <em>sum += float(input("Enter a decimal number to sum: "))</em>  is simply asking the user for a number, taking that input and converting it from a string into a float, and then summing the value with the previous value of sum and saving that into sum.

The fourth line of code, <em>print ("Sum: ", sum)</em> is simply displaying the final value that was calculated by adding the three user inputs together which were stored into the variable <em>sum</em>.

Cheers.

6 0
2 years ago
Read 2 more answers
You need to fax a portion of a map from a large hard-cover atlas to a client from an internal fax-modem. To fax the map, the bes
Kay [80]
The fax modem is used to send and receive fax messages by only having phone line (fax machine is not required). The scanned documents should be saved as digital file (image or PDF format) in order to be sent. So, in order to send a portion of a map you should first convert the map into digital file and than simply send it through the fax modem. The best way to convert it to a digital file is to use an optical character recognition (OCR). 
6 0
3 years ago
You develop an app, and you don’t want anyone to resell it or modify it. This is an example of: A
Maru [420]

Answer:

C, proprietary software

Explanation:

Proprietary software, also known as non-free software, is computer software for which the software's publisher or another person reserves some rights from licensees to use, modify, share modifications, or share the software. It sometimes includes patent rights.

7 0
3 years ago
________ is the process of inspecting data that has been input to a program to make sure it is valid before using it in a comput
Mumz [18]

Answer:

Hence, <u>Input Validation</u> is the process of inspecting data that has been input to a program to make sure it is valid before using it in a computation.

Explanation:

The input should be validated before further processing to avoid problems in execution of program afterwards.

The process of input validation is defined to make sure that the input is valid.

Hence, <u>Input Validation</u> is the process of inspecting data that has been input to a program to make sure it is valid before using it in a computation ..

3 0
3 years ago
Other questions:
  • A(n) ________ software installation enables you to decide which features you want to install on the hard drive. Select one: A. f
    10·1 answer
  • HELP PLEASE
    5·1 answer
  • When a file is transferred between two computers, two acknowledgment strategies are possible. In the first one, the file is chop
    5·1 answer
  • sqrt is being defined as a variable name, how do I get its math function to... well... function? (Python)
    11·1 answer
  • On which of the following pointing devices can you control the pointer by sliding your fingertip?
    11·1 answer
  • What tends to happen to the accuracy of our savings goals as our investment horizon becomes longer? A. It is not useful to have
    11·1 answer
  • DO NOT ANSWER FOR JUST POINTS
    8·2 answers
  • How many times will line 7 be executed when the following code is run?
    5·1 answer
  • Anybody wants to join my pad let to talk about video games
    7·2 answers
  • What are the three algorithm constructs?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!