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
vovangra [49]
3 years ago
7

Milestone 1: Write code which asks for a length input until it gets an integer 10 or greater, then creates 2 arrays of this leng

th. Milestone 2: Write code which fills each of the arrays with random integers which are between 1 and 100 inclusive and displays the arrays. Milestone 3: Set up code to loop through each element of the original arrays which are to be checked and added. Milestone 4: Make program check through each previously filled element of the merge array to see if it contains the next value to be added and add this value if it does not already appear. Prints all values of merge array, without including the 0s at the end of the array.
Engineering
1 answer:
jonny [76]3 years ago
3 0

Answer:

import java.util.Scanner;

import java.lang.Math;

class Main {

  public static void main(String[] args) {

      int length = 0;

      boolean lengthCheck = true;

      Scanner scan = new Scanner(System.in);

      while (lengthCheck == true)

      {

          System.out.println("Enter an array length (must be 10 or greater):");

          length = scan.nextInt();

          if (length >= 10)

          {

              lengthCheck = false;

          }

      }

      int[] firstArray = new int[length];

      int[] secondArray = new int[length];

      System.out.print("\nFirst Array: ");

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

      {

          firstArray[i] = (int) (Math.random() * 100) + 1;

          System.out.print(firstArray[i] + " ");

      }

      System.out.print("\n\nSecond Array: ");

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

      {

          secondArray[i] = (int) (Math.random() * 100) + 1;

          System.out.print(secondArray[i] + " ");

      }

      System.out.println("\n");

     

      boolean[] isAdded = new boolean[100];

      int[] merge = new int[(firstArray.length + secondArray.length)];

     

      int j=0;

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

      {

          if(!isAdded[firstArray[i] - 1]) {

              merge[j] = firstArray[i];

              j++;

              isAdded[firstArray[i] - 1] = true;

          }

         

          if(!isAdded[secondArray[i] - 1]) {

              merge[j] = secondArray[i];

              j++;

              isAdded[secondArray[i] - 1] = true;

          }

         

      }

     

      System.out.print("Merged Array: ");

     

      for (int i = 0; i < 2*length && merge[i] != 0; i++)

      {

          System.out.print(merge[i] + " ");

      }

      System.out.println("\n");

     

  }

}

You might be interested in
a vertical cylindrical container is being cooled in ambient air at 25 °C with no air circulation. if the initial temperature of
Sloan [31]

Answer:

the surface heat-transfer coefficient due to natural convection during the initial cooling period.  = 4.93 w/m²k

Explanation:

check attachement for answer explanation

7 0
3 years ago
Read 2 more answers
About what thickness of aluminum is needed to stop a beam of (a) 2.5-MeV electrons, (b) 2.5-MeV protons, and (c) 10-MeV alpha pa
Nana76 [90]

The thickness of aluminium needed to stop the beam electrons, protons and alpha particles at the given dfferent kinetic energies is 1.5 x 10⁻¹⁴ m.

<h3>Thickness of the aluminum</h3>

The thickness of the aluminum can be determined using from distance of closest approach of the particle.

K.E = \frac{2KZe^2}{r}

where;

  • Z is the atomic number of aluminium  = 13
  • e is charge
  • r is distance of closest approach = thickness of aluminium
  • k is Coulomb's constant = 9 x 10⁹ Nm²/C²
<h3>For 2.5 MeV electrons</h3>

r = \frac{2KZe^2}{K.E} \\\\r = \frac{2 \times 9\times 10^9 \times 13\times (1.6\times 10^{-19})^2}{2.5 \times 10^6 \times 1.6 \times 10^{-19}} \\\\r = 1.5 \times 10^{-14} \ m

<h3>For 2.5 MeV protons</h3>

Since the magnitude of charge of electron and proton is the same, at equal kinetic energy, the thickness will be same. r = 1.5 x 10⁻¹⁴ m.

<h3>For 10 MeV alpha-particles</h3>

Charge of alpah particle = 2e

r = \frac{2KZe^2}{K.E} \\\\r = \frac{2 \times 9\times 10^9 \times 13\times (2 \times 1.6\times 10^{-19})^2}{10 \times 10^6 \times 1.6 \times 10^{-19}} \\\\r = 1.5 \times 10^{-14} \ m

Thus, the thickness of aluminium needed to stop the beam electrons, protons and alpha particles at the given dfferent kinetic energies is 1.5 x 10⁻¹⁴ m.

Learn more about closest distance of approach here: brainly.com/question/6426420

7 0
2 years ago
Comparison of density values determines whether an item will float or sink in water. For each of the values below, determine the
geniusboy [140]

Answer:

a) the object floats

b) the object floats

c) the object sinks

Explanation:

when an object is less dense than in the fluid in which it is immersed, it will float due to its weight and volume characteristics, so to solve this problem we must find the mass and volume of each object in order to calculate the density and compare it with that of water

a)

volumen for a cube

V=L^3

L=1.53in=0.0388m

V=0.0388 ^3=5.8691x10^-5m^3=58.69ml

density=m/v

density=13.5g/58.69ml=0.23 g/ml

The wooden block floats  because it is less dense than water

b)

m=111mg=0.111g

density=m/v

density=0.111g/0.296ml=0.375g/ml

the metal paperclip floats   because it is less dense than water

c)

V=0.93cups=220.0271ml

m=0.88lb=399.1613g

Density=m/v

density=399.1613/220.027ml=1.8141g/ml

the apple sinks   because it is  denser than water

4 0
3 years ago
When lining up the song on the tempo grid it is important to allow
Reika [66]

Tempo decides the speed at which the music is played.

<u>Explanation:</u>

The Tempo of a bit of music decides the speed at which it is played, and is estimated in beats per minute (BPM). The 'beat' is dictated when mark of the piece, so 100 BPM in 4/4 compares to 100 quarter notes in a single moment.

A quick tempo, prestissimo, has somewhere in the range of 200 and 208 beats for each moment, presto has 168 to 200 beats for every moment, allegro has somewhere in the range of 120 and 168 beats for every moment, moderato has 108 to 120 beats for every moment, moderately slow and even has 76 to 108, adagio has 66 to 76, larghetto has 60 to 66, and largo, the slowest rhythm, has 40 to 60.

6 0
3 years ago
Which of these is the BEST description of
strojnjashka [21]

Answer:

i would say C but i may be wrong have a great day

Explanation:

3 0
3 years ago
Other questions:
  • 7 Single-use earplugs require a professional fitting before they can be used.
    10·2 answers
  • Volume of sale (i.e., the number of parts sold) is a factorwhen determining which
    8·1 answer
  • What are 3 reasons why small businesses are an important part of the American economy?
    9·2 answers
  • Time complexity of merge sort
    15·1 answer
  • How should employees talk to clients)
    9·1 answer
  • In a surface grinding operation, the wheel diameter = 8.0 in, wheel width = 1.0 in, wheel speed = 6000 ft/min, work speed = 40 f
    9·1 answer
  • Linus is using a calculator to multiply 5,426 and 30. He enters 5,426 x 300 by mistake. What can Linus do to correct his mistake
    7·1 answer
  • Fig. 4 shows a simply-supported beam with supports A and B. The beam is subjected to three forces, 2000 N, 4000 N and 1500 N in
    5·1 answer
  • In the car industry, clay models are used to visualize and test new car designs.
    5·2 answers
  • What is voltage drop?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!