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
In addition to bandages and gauze, it's recommended that a first aid kit also contain ___________. A) A finger splintB) Portable
valina [46]

Answer: (D: Tweezers)

A basic first aid kit is always good to have in case of an emergency. The typical items found in a first aid kit are pain reliever, tweezers, alcohol wipes, gloves, antiseptic, medical tape, sterile gauze, insect bite swaps, triple-antibiotic ointment, hydrogen peroxide, bandage scissors, instant cold compresses, and of course bandages. There are various types of bandages that can be included; elastic bandages, adhesive bandages, and triangular bandages for starters.

Explanation:

4 0
3 years ago
Two variables, num_boys and num_girls, hold the number of boys and girls that have registered for an elementary school. The vari
Flauer [41]

Answer:

Using python

num_boys = int(input("Enter number of boys :"))

num_girls = int(input("Enter number of girls :"))

budget = int(input("Enter the number of dollars spent per school year :"))

try:

dollarperstudent = budget/(num_boys+num_girls)

print("Dollar spent per student : "+str(dollarperstudent))#final result

except ZeroDivisionError:

print("unavailable")

3 0
3 years ago
Balanced forces will result in which of the following
tia_tia [17]
D is the answer. Hope this helped
8 0
3 years ago
At an impaired driver checkpoint, the time required to conduct the impairment test varies (according to an exponential distribut
professor190 [17]

Answer:

Option (d) 2 min/veh

Explanation:

Data provided in the question:

Average time required = 60 seconds

Therefore,

The maximum capacity that can be accommodated on the system, μ = 60 veh/hr

Average Arrival rate, λ = 30 vehicles per hour

Now,

The average time spent by the vehicle is given as

⇒ \frac{1}{\mu(1-\frac{\lambda}{\mu})}

thus,

on substituting the respective values, we get

Average time spent by the vehicle = \frac{1}{60(1-\frac{30}{60})}

or

Average time spent by the vehicle = \frac{1}{60(1-0.5)}

or

Average time spent by the vehicle = \frac{1}{60(0.5)}

or

Average time spent by the vehicle = \frac{1}{30} hr/veh

or

Average time spent by the vehicle = \frac{1}{30}\times60 min/veh

[ 1 hour = 60 minutes]

thus,

Average time spent by the vehicle = 2 min/veh

Hence,

Option (d) 2 min/veh

7 0
3 years ago
A four-cylinder, four-stroke internal combustion engine has a bore of 3.7 in. and a stroke of 3.4 in. The clearance volume is 16
abruzzese [7]

Answer:

1) The three possible assumptions are

a) All processes are reversible internally

b) Air, which is the working fluid circulates continuously in a closed loop

cycle

c) The process of combustion is depicted as a heat addition process

2) The diagrams are attached

5) The net work per cycle is 845.88 kJ/kg

The power developed in horsepower ≈ 45374 hP

Explanation:

1) The three possible assumptions are

a) All processes are reversible internally

b) Air, which is the working fluid circulates continuously in a closed loop

cycle

c) The process of combustion is depicted as a heat addition process

2) The diagrams are attached

5) The dimension of the cylinder bore diameter = 3.7 in. = 0.09398 m

Stroke length = 3.4 in. = 0.08636 m.

The volume of the cylinder v₁= 0.08636 ×(0.09398²)/4 = 5.99×10⁻⁴ m³

The clearance volume = 16% of cylinder volume = 0.16×5.99×10⁻⁴ m³

The clearance volume, v₂  = 9.59 × 10⁻⁵ m³

p₁ = 14.5 lbf/in.² = 99973.981 Pa

T₁ = 60 F = 288.706 K

\dfrac{T_{2}}{T_{1}} = \left (\dfrac{v_{1}}{v_{2}}  \right )^{K-1}

Otto cycle T-S diagram

T₂ = 288.706*6.25^{0.393} = 592.984 K

The maximum temperature = T₃ = 5200 R = 2888.89 K

\dfrac{T_{3}}{T_{4}} = \left (\dfrac{v_{4}}{v_{3}}  \right )^{K-1}

T₄ = 2888.89 / 6.25^{0.393} = 1406.5 K

Work done, W = c_v×(T₃ - T₂) - c_v×(T₄ - T₁)

0.718×(2888.89  - 592.984) - 0.718×(1406.5 - 288.706) = 845.88 kJ/kg

The power developed in an Otto cycle = W×Cycle per second

= 845.88 × 2400 / 60  = 33,835.377 kW = 45373.99 ≈ 45374 hP.

8 0
3 years ago
Other questions:
  • Describe the steps, tools, and technology needed in detail and
    12·1 answer
  • A hydrogen-filled balloon to be used in high altitude atmosphere studies will eventually be 100 ft in diameter. At 150,000 ft, t
    7·1 answer
  • Energy that causes a transfer of heat between marterials
    13·1 answer
  • The engine of a 2000kg car has a power rating of 75kW. How long would it take (seconds) to accelerate from rest to 100 km/hr at
    10·1 answer
  • Air is to be heated steadily by an 8-kW electric resistance heater as it flows through an insulated duct. If the air enters at 5
    10·1 answer
  • I need solution for this question ​
    10·1 answer
  • Compute the volume percent of graphite, VGr, in a 2.5 wt% C cast iron, assuming that all the carbon exists as the graphite phase
    9·1 answer
  • How do people eat with there noses shut
    12·2 answers
  • What is one of the most common ways in which workers get hurt around machines?
    14·1 answer
  • What classes do you have to take in college for be a system software engineer
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!