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
I ran across this symbol in some Electrical wiring documents and I am unaware of what this means. Any help?
Minchanka [31]

Answer:

Opened Push-button Switch (i.e. a PTM Switch)

Explanation:

Tha's just another symbol for a switch, but this one specifies that the switch is a push-button type of switch.

Since it's not touching and completing the line, the state of the switch is initially open.

6 0
3 years ago
2. A counter flow tube-shell heat exchanger is used to heat a cold water stream from 18 to 78oC at a flow rate of 1 kg/s. Heatin
Anastaziya [24]

Answer:

a) L = 220\,m, b) U_{o} \approx 0.63\,\frac{kW}{m^{2}\cdot ^{\textdegree}C}

Explanation:

a) The counterflow heat exchanger is presented in the attachment. Given that cold water is an uncompressible fluid, specific heat does not vary significantly with changes on temperature. Let assume that cold water has the following specific heat:

c_{p,c} = 4.186\,\frac{kJ}{kg\cdot ^{\textdegree}C}

The effectiveness of the counterflow heat exchanger as a function of the capacity ratio and NTU is:

\epsilon = \frac{1-e^{-NTU\cdot(1-c)}}{1-c\cdot e^{-NTU\cdot (1-c)}}

The capacity ratio is:

c = \frac{C_{min}}{C_{max}}

c = \frac{(1\,\frac{kg}{s} )\cdot(4.186\,\frac{kW}{kg^{\textdegree}C} )}{(1.8\,\frac{kg}{s} )\cdot(4.30\,\frac{kW}{kg^{\textdegree}C} )}

c = 0.541

Heat exchangers with NTU greater than 3 have enormous heat transfer surfaces and are not justified economically. Let consider that NTU = 2.5. The efectiveness of the heat exchanger is:

\epsilon = \frac{1-e^{-(2.5)\cdot(1-0.541)}}{1-(2.5)\cdot e^{-(2.5)\cdot (1-0.541)}}

\epsilon \approx 0.824

The real heat transfer rate is:

\dot Q = \epsilon \cdot \dot Q_{max}

\dot Q = \epsilon \cdot C_{min}\cdot (T_{h,in}-T_{c,in})

\dot Q = (0.824)\cdot (4.186\,\frac{kW}{^{\textdegree}C} )\cdot (160^{\textdegree}C-18^{\textdegree}C)

\dot Q = 489.795\,kW

The exit temperature of the hot fluid is:

\dot Q = \dot m_{h}\cdot c_{p,h}\cdot (T_{h,in}-T_{h,out})

T_{h,out} = T_{h,in} - \frac{\dot Q}{\dot m_{h}\cdot c_{p,h}}

T_{h,out} = 160^{\textdegree}C + \frac{489.795\,kW}{(7.74\,\frac{kW}{^{\textdegree}C} )}

T_{h,out} = 96.719^{\textdegree}C

The log mean temperature difference is determined herein:

\Delta T_{lm} = \frac{(T_{h,in}-T_{c, out})-(T_{h,out}-T_{c,in})}{\ln\frac{T_{h,in}-T_{c, out}}{T_{h,out}-T_{c,in}} }

\Delta T_{lm} = \frac{(160^{\textdegree}C-78^{\textdegree}C)-(96.719^{\textdegree}C-18^{\textdegree}C)}{\ln\frac{160^{\textdegree}C-78^{\textdegree}C}{96.719^{\textdegree}C-18^{\textdegree}C} }

\Delta T_{lm} \approx 80.348^{\textdegree}C

The heat transfer surface area is:

A_{i} = \frac{\dot Q}{U_{i}\cdot \Delta T_{lm}}

A_{i} = \frac{489.795\,kW}{(0.63\,\frac{kW}{m^{2}\cdot ^{\textdegree}C} )\cdot(80.348^{\textdegree}C) }

A_{i} = 9.676\,m^{2}

Length of a single pass counter flow heat exchanger is:

L =\frac{A_{i}}{\pi\cdot D_{i}}

L = \frac{9.676\,m^{2}}{\pi\cdot (0.014\,m)}

L = 220\,m

b) Given that tube wall is very thin, inner and outer heat transfer areas are similar and, consequently, the cold side heat transfer coefficient is approximately equal to the hot side heat transfer coefficient.

U_{o} \approx 0.63\,\frac{kW}{m^{2}\cdot ^{\textdegree}C}

5 0
3 years ago
4. Partnership programs between schools and the owners
rusak2 [61]

Answer:

Automotive Technology Program

Explanation:

Basically hiring students for hands on training to learn the basics of mechanics.

4 0
3 years ago
Multiple Choice
katrin [286]

Answer:

Zoning is like a hammer because it is used as a tool for urban planning.

8 0
3 years ago
Suppose you want to buy a new car. The car will be used mainly for going to work, shopping, running errands, and visiting friend
Sergeu [11.5K]
1. So you can complete the things you NEED to do faster. (I.e work, groceries)

2. So it’s easier for you to do leisure activities. (I.e visiting friends, shopping)
5 0
3 years ago
Other questions:
  • A disk brake has two pads which cover 45 degrees of the disk. The outside radius is 6.0 inch and the inside radius is 4.0 inch.
    5·1 answer
  • A force that attempts to decrease the length of a structural member is____
    14·1 answer
  • What is the best way to submit your assignments?
    11·2 answers
  • What are the prefixes for 1, 10, 1000, 1,000,000, .1, .01, .001, .000001
    9·1 answer
  • La Patrulla Fronteriza de los Estados Unidos analiza la compra de un helicóptero nuevo para la vigilancia aérea de la frontera d
    14·1 answer
  • Which statement describes the relay between minerals and rocks ?
    15·1 answer
  • Which component found in fertilizer is a known cancer-causing agent?
    11·2 answers
  • PROBLEM IN PICTURE HELP ME DEAR GODDDDDD UGHHH NONONO I HAVE 2 MINUTES TO FINISH THIS ❕❗️❕❗️❗️❕❕❕❕❗️❕❕❗️❕❗️❗️❗️❕‼️‼️‼️‼️❗️‼️❗️
    11·2 answers
  • Witch measuring tool would be used to determine the diameter of a crankshaft journal
    5·1 answer
  • fdkgdsvdgvdfgvsdcvbfbfdbvfdbsdvbesgvdslgfkrledmgoskflodjgloerjgvoljgegjp;erorf;wgp;kiaers;ogjo;rhgerjfrejgfdlhodjglodjheihtgo;rg
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!