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]
4 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]4 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
You find an unnamed fluid in the lab we will call Fluid A. Fluid A has a specific gravity of 1.65 and a dynamic viscosity of 210
Naily [24]

Answer:

1.2727 stokes

Explanation:

specific gravity of fluid A = 1.65

Dynamic viscosity = 210 centipoise

<u>Calculate the kinematic viscosity of Fluid A </u>

First step : determine the density of fluid A

Pa = Pw * Specific gravity =  1000 * 1.65 = 1650 kg/m^3

next : convert dynamic viscosity to kg/m-s

210 centipoise = 0.21 kg/m-s

Kinetic viscosity of Fluid A = dynamic viscosity / density of fluid A

                                            = 0.21 / 1650 = 1.2727 * 10^-4 m^2/sec

Convert to stokes = 1.2727 stokes

4 0
3 years ago
Briefly explain how each of the following influences the tensile modulus of a semicrystalline polymer and why:(a) molecular weig
marin [14]

Answer:

(a) Increases

(b) Increases

(c) Increases

(d) Increases

(e) Decreases

Explanation:

The tensile modulus of a semi-crystalline polymer depends on the given factors as:

(a) Molecular Weight:

It increases with the increase in the molecular weight of the polymer.

(b) Degree of crystallinity:

Tensile strength of the semi-crystalline polymer increases with the increase in the degree of crystallinity of the polymer.

(c) Deformation by drawing:

The deformation by drawing in the polymer results in the finely oriented chain structure of the polymer with the greater inter chain secondary bonding structure resulting in the increase in the tensile strength of the polymer.

(d) Annealing of an undeformed material:

This also results in an increase in the tensile strength of the material.

(e) Annealing of  a drawn material:

A semi crystalline material which is drawn when annealed results in the decreased tensile strength of the material.

5 0
3 years ago
PLEASE QUICK!!! what phrase describes an ad hominem fallacy?
Igoryamba

Answer:

personal attack

Explanation:

it is personal attack

5 0
3 years ago
why can planes fly but boats cant and why can boats float but not planes and saying planes fly because of the wind or air is not
Aleksandr-060686 [28]

Answer:

Planes can fly because they have wings and jet turbines and boats cant they need wings and planes cant float because there is to much weight

4 0
3 years ago
Read 2 more answers
8. A voltmeter measures a voltage drop of 600 V across a heating element while an
Alchen [17]

Answer:

How do I calculate voltage drop?

To calculate voltage drop, E, across a component, you need to know the resistance of the component and the current thru it. Ohm's Law is E=I⋅R , which tells us to then multiply I by R . E is the voltage across the component also known as voltage drop

Explanation:

5 0
2 years ago
Other questions:
  • Your program should read from an input file, which will contain one or more test cases. Each test case consists of one line cont
    14·1 answer
  • What is the rms current flowing through a light bulb that uses an average power of 60.0 60.0 W when it is plugged into a wall re
    12·1 answer
  • One kilogram of water fills a 150-L rigid container at an initial pressure of 2 MPa. The container is then cooled to 40∘C. Deter
    7·1 answer
  • Electrical pressure or “force”<br><br> A) current<br> B) resistance <br> C) voltage
    6·1 answer
  • A pipe leads from a storage tank on the roof of a building to the ground floor. The absolute pressure of the water in the storag
    7·1 answer
  • An engineer measures a sample of 1200 shafts out of a certain shipment. He finds the shafts have an average diameter of 2.45 inc
    15·1 answer
  • 37. In ______ combination of drugs, the effects of one drug cancel or diminish
    12·1 answer
  • A total of 245 kip force is applied to a set of 10 similar bolts. If the spring constant of each bolt is 0.4 Mlb/in and that of
    9·1 answer
  • A heating system must maintain the interior of a building at TH = 20 °C when the outside temperature is TC = 2 °C. If the rate o
    10·1 answer
  • Does an electronic clock use electrical energy?​
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!