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
For each of the resistors shown below, use Ohm's law to calculate the unknown quantity, Be sure to put your answer in proper eng
daser333 [38]

Answer:

the hurts my brain sorry bud cant help

Explanation:

6 0
3 years ago
A structural component in the form of a wide plate is to be fabricated from a steel alloy that has a plane-strain fracture tough
jeyben [28]

Complete question:

A structural component in the form of a wide plate is to be fabricated from a steel alloy that has a plane strain fracture toughness of 98.9 MPa root m (90 ksi root in.) and a yield strength of 860 MPa (125,000 psi). The flaw size resolution limit of the flaw detection apparatus is 3.0 mm (0.12 in.). If the design stress is one-half of the yield strength and the value of Y is 1.0, determine whether or not a critical flaw for this plate is subject to detection.

Answer:

Since the flaw 17mm is greater than 3 mm the critical flaw for this plate is subject to detection

so that critical flow is subject to detection  

Explanation:

We are given:

Plane strain fracture toughness K = 98.9 MPa \sqrt{m}

Yield strength Y = 860 MPa

Flaw detection apparatus = 3.0mm (12in)

y = 1.0

Let's use the expression:

oc = \frac{K}{Y \sqrt{pi * a}}

We already know

K= design

a = length of surface creak

Since we are to find the length of surface creak, we will make "a" subject of the formula in the expression above.

Therefore

a= \frac{1}{pi} * [\frac{k}{y*a}]^2

Substituting figures in the expression above, we have:

= \frac{1}{pi} * [\frac{98.9 MPa \sqrt{m}} {10 * \frac{860MPa}{2}}]^2

= 0.0168 m

= 17mm

Therefore, since the flaw 17mm > 3 mm the critical flow is subject to detection  

3 0
3 years ago
Read 2 more answers
t is desired to produce aligned carbon fiber-epoxy matric composite having a longitudinal tensile strength of 800 MPa. Given (a)
Nesterboy [21]

Answer:

The value of critical length = 3.46 mm

The value of volume of fraction of fibers = 0.43

Explanation:

Given data

\sigma_{T} =  800 M pa

D = 0.017 mm

L = 2.3 mm

\sigma_{f} = 5500 M pa

\sigma_{m} = 18 M pa

\sigma_c = 13.5 M pa

(a) Critical fiber length is given by

L_{c} = \sigma_{f} (\frac{D}{2 \sigma_{c} } )

Put all the values in above equation we get

L_{c} =5500 (\frac{0.017}{(2) (13.5)} )

L_{c} = 3.46 mm

This is the value of critical length.

(b).Since this  critical length is greater than fiber length Than the volume fraction of fibers is given by

V_{f} = \frac{\sigma_T - \sigma_m}{\frac{L\sigma_c}{D} - \sigma_m }

Put all the values in above formula we get

V_{f} = \frac{800-18}{\frac{(2.3)(13.5)}{0.017} - 18 }

V_{f} = 0.43

This is the value of volume of fraction of fibers.

3 0
3 years ago
Consider the following list. list = {24, 20, 10, 75, 70, 18, 60, 35} Suppose that list is sorted using the insertion sort algori
Greeley [361]

Answer:

Option B

10,20,24,75,70,18,60,35

Explanation:

The first, second and third iteration of the loop will be as follows

insertion sort iteration 1: 20,24,10,75,70,18,60,35

insertion sort iteration 2:10,20,24,75,70,18,60,35

insertion sort iteration 3: 10,20,24,75,70,18,60,35

8 0
3 years ago
Text that is located between &lt;title &gt;and &lt;/title &gt; appears in the browser's_____​
Vinil7 [7]

Answer:

Tab title

Explanation:

The tab title can be defined as the title that shows up in a browser tab known as page title. The title only has texts, other tags within the texts are not considered.

8 0
3 years ago
Other questions:
  • Many companies are combining their online business activities with an existing physical presence. In about 100 words, explain wh
    11·1 answer
  • For a p-n-p BJT with NE 7 NB 7 NC, show the dominant current components, with proper arrows, for directions in the normal active
    14·1 answer
  • Electrical strain gauges were applied to a notched specimen to determine the stresses in the notch. The results were εx=0.0019 a
    13·1 answer
  • What is the composition, in atom percent, of an alloy that contains 44.5 lbmof Ag, 83.7 lbmof Au, and 5.3 lbmof Cu? What is the
    9·1 answer
  • Find the general solution of the equation<br>a) Tan A = 1/√3​
    11·1 answer
  • Calculate the number of vacancies per cubic meter at 1000∘C for a metal that has an energy for vacancy formation of 1.22 eV/atom
    14·1 answer
  • A force measuring instrument comes with a certificate of calibration that identifies two instrument errors and assigns each an u
    12·1 answer
  • Most technician jobs in the field of metrology require a college degree. True or False?
    5·2 answers
  • Hi I'm trying to build a desk that moves up and down electrically but i need help
    9·1 answer
  • In surveying , supposing we can not pull the tape because it is passing through a shallow river. What will i do to obtain an acc
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!