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
mariarad [96]
3 years ago
6

1) Declare an ArrayList named numberList that stores objects of Integer type. Write a loop to assign first 11 elements values: 1

, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024. Do not use Math.pow method. Assign first element value 1. Determine each next element from the previous one in the number List. Print number List by using for-each loop.
Computers and Technology
1 answer:
Ymorist [56]3 years ago
3 0

Answer:

Explanation:

The following is written in Java and uses a for loop to add 10 elements to the ArrayList since the first element is manually added as 1. Then it calculates each element by multiplying the previous element (saved in count) by 2. The program works perfectly and without bugs. A test output can be seen in the attached image below.

import java.util.ArrayList;

class Brainly {

   public static void main(String[] args) {

       ArrayList<Integer> numberList = new ArrayList<>();

       numberList.add(0, 1);

       int count = 1;

       for (int i = 1; i < 11; i++) {

           numberList.add(i, (count * 2));

           count = count * 2;

       }

       for (Integer i : numberList) {

           System.out.println(i);

       }

   }

}

You might be interested in
Electronic data interchange (EDI) and electronic funds transfer (EFT) are forms of__________e-commerce transactions.
Allisa [31]

Answer:

d

Explanation:

8 0
1 year ago
Which of the following best defines natural selection?
Vsevolod [243]
The answer is differential success in some organisms reproduction due to traits that favor survival <span />
6 0
3 years ago
Folders are containers used to organize the documents into manageable groups on a designated storage device. true or false
AysviL [449]

Answer:

true

Explanation:

folders are used to organize documents into manageable groups on storage devices

5 0
4 years ago
Consider the language S*, where S = {a ab ba}.
Nezavi [6.7K]

Answer:

Check Explanation

Explanation:

A) the string (abbba) is not a word in this language because in this language, each b must preceded or followed by an a. Three consecutive b's are just not possible.

B) All the words with 3 letters in this language

aaa

aab

aba

baa

C) 5 words with four letters from this language. I'll write as many as possible to make things as easy as possible.

aaaa

aaab

aaba

baab

baba

baaa

abaa

abab

abba

D) This is the language of words without bbb, with every bb preceded and followed by an a (that is, no word can start or end wilth bb). All non-empty strings contain at least one a (so b and bb together are not allowed!).

Hope this Helps!!!

6 0
3 years ago
Write the code to create a variable score and assign it the value 0?​
Galina-37 [17]

Answer:

You can assign a value to a routine variable in any of the following ways:

Use a LET statement.

Use a SELECT INTO statement.

Use a CALL statement with a procedure that has a RETURNING clause.

Use an EXECUTE PROCEDURE INTO or EXECUTE FUNCTION INTO statement.

Explanation:

4 0
3 years ago
Other questions:
  • Design the below using an array// Sunrise Freight charges standard// per-pound shipping prices to the five states they serve// –
    6·1 answer
  • Morgan's cursor is blinking in the center of the page but he would like to move it to the left margin. He should _____.
    10·1 answer
  • ________ is the gathering, organizing, sharing, and analyzing of the data and information to which a business has access.
    6·1 answer
  • Which of the following is the java comparison operator for "not equal to"
    10·1 answer
  • Which of the following are examples of how a company might use consumer data it had collected? a To decide what types of product
    10·1 answer
  • This finding maximum number function will keep on going until we reach at the last value
    12·1 answer
  • Any one know??please let me know
    15·2 answers
  • List of rules for expert systems​
    6·1 answer
  • ¿Consideran que nuestra sociedad chilena (modelo económico, los medios de comunicación, educación, la publicidad) promueve la sa
    11·1 answer
  • Who would win in a fight, Noble 6 from halo reach or Master Chief??
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!