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
Montano1993 [528]
2 years ago
13

2.4: Add a method called setValue(), and the description of setValue is: public int setValue(long searchKey) In this method, the

array will be examined if searchKey is already in the array. If this is the case, the index of found searchKey in the array will be returned; If searchKey is not in the array, insert it to the array and return the index where it is inserted. Add some code in main() to exercise this method.
Engineering
1 answer:
Yanka [14]2 years ago
6 0

Answer:

Below is java code that must be used for the given question:

// highArray.java

// demonstrates array class with high-level interface

// to run this program: C>java HighArrayApp

////////////////////////////////////////////////////////////////

class HighArray

  {

  private long[] a;                 // ref to array a

  private int nElems;               // number of data items

  //-----------------------------------------------------------

  public HighArray(int max)         // constructor

     {

     a = new long[max];                 // create the array

     nElems = 0;                        // no items yet

     }

  //-----------------------------------------------------------

  public setValue find(long searchKey)

     {                              // find specified value

     int j;

     for(j=0; j<nElems; j++)            // for each element,

        if(a[j] == searchKey)           // found item?

           break;                       // exit loop before end

     if(j == nElems)                    // gone to end?

        return false;                   // yes, can't find it

     else

        return true;                    // no, found it

     }  // end find()

  //-----------------------------------------------------------

  public void insert(long value)    // put element into array

     {

     a[nElems] = value;             // insert it

     nElems++;                      // increment size

     }

  //-----------------------------------------------------------

  public void display()             // displays array contents

     {

     for(int j=0; j<nElems; j++)       // for each element,

        System.out.print(a[j] + " ");  // display it

     System.out.println("");

     }

  //-----------------------------------------------------------

  }  // end class HighArray

////////////////////////////////////////////////////////////////

class HighArrayApp

  {

  public static void main(String[] args)

     {

     int maxSize = 100;            // array size

     HighArray arr;                // reference to array

     arr = new HighArray(maxSize); // create the array

     arr.insert(77);               // insert 10 items

     arr.insert(99);

     arr.insert(44);

     arr.insert(55);

     arr.insert(22);

     arr.insert(88);

     arr.insert(11);

     arr.insert(00);

     arr.insert(66);

     arr.insert(33);

     arr.display();                // display items

     int searchKey = 35;           // search for item

     if( arr.find(searchKey) )

        System.out.println("Found " + searchKey);

     else

        System.out.println("Can't find " + searchKey);

     }  // end main()

  }  // end class HighArrayApp

Explanation:

You might be interested in
Liquid water is fed to a boiler at 24°C and 10 bar is converted at a constant pressure to saturated steam.
zepelin [54]

We can find the change in the enthalpy through the tables A5 for Saturated water, pressure table.

For 1bar=1000kPa:

T_{sat}=179.88\°c

H_{fg} = 2014.6kJ/kg

c_p=4.18 kJkg^{-1}{K^{-1}

\nu_g = 0.19436m^3/kg

Replacing,

\Delta h = h_{fg}+c_p(T_{sat}-T_{inlet})

\Delta h = 2014.6+4.18(179.88-24)

\Delta h=2666.17kJ/kg

With the specific volume we know can calculate the mass flow, that is

\dot{m}=\frac{\frac{15000}{3600}}{0.19436}

\dot{m} = 21.4378kg/s

Then the heat required in input is,

Q=\dot{m}\Delta h

Q=21.4378*2666.17

Q=57157.036kW

With the same value required of 15000m^3/h, we can calculate the velocity of the water, that is given by,

V= \frac{\dotV}{A}

V = \frac{\frac{15000}{3600}}{\pi /4 *(0.15)^2}

V=235.79m/s

Finally we can apply the steady flow energy equation, that is

\dot{m}(h_1+\frac{V^2}{2000})+Q = \dot{m}h_2

Re-arrange for Q,

Q=\dot{m}(h_2-h_1-\frac{V^2}{2000})

Q=\dot{m}(\Delta h-\frac{V^2}{2000})

Q= (21.4378)(2666.17-\frac{235.79^2}{2000})

Q= 56560.88kW

We can note that consider the Kinetic Energy will decrease the heat input.

4 0
3 years ago
for high-volume production runs, machining parts from solid material might not be the best choice of manufacturing operations be
Naddik [55]

Answer:

There are actually multiple types of processes a manufacturer uses, and those can be grouped into four main categories: casting and molding, machining, joining, and shearing and forming.

Explanation:

8 0
3 years ago
At a certain location, wind is blowing steadily at 7 m/s. Determine the mechanical energy of air per unit mass and the power gen
Kaylis [27]

Answer:

Explanation:

From the information given;

The velocity of the wind blow V = 7 m/s

The diameter of the blades  (d) = 80 m

Percentage of the overall efficiency \eta_{overall} = 30\%

The density of air \rho = 1.25 kg/km^3

Then, we can use the concept of the kinetic energy of the wind blowing to estimate the mechanic energy of air per unit mass by using the formula:

e_{mechanic} = \dfrac{mV^2}{2}

here;

m = \rho AV

= 1.25 \times \dfrac{\pi}{4}(80)^2 \times 7

= 43982.29 kg/s

∴

W = e_{mechanic} = \dfrac{mV^2}{2}

= \dfrac{43982.29 \times 7^2}{2}

= 1077566.105 \ W

\mathbf{ =1077.566 \ kW}

The actual electric power is:

W_{electric} = \eta_{overall} \times W

W_{electric} = 0.3 \times 1077.566

\mathbf{W_{electric} =323.26 \ kW}

8 0
2 years ago
The entire system of components that produces power and transmits it to the road is called the vehicle's _____.
IrinaK [193]

Answer:

Powertrain

Explanation:

6 0
3 years ago
A furnace wall composed of 200 mm, of fire brick. 120 mm common brick 50mm 80% magnesia and 3mm of steel plate on the outside. I
Liula [17]

Answer:

  • fire brick / common brick : 1218 °C
  • common brick / magnesia : 1019 °C
  • magnesia / steel : 90.06 °C
  • heat loss: 4644 kJ/m^2/h

Explanation:

The thermal resistance (R) of a layer of thickness d given in °C·m²·h/kJ is ...

  R = d/k

so the thermal resistances of the layers of furnace wall are ...

  R₁ = 0.200/4 = 0.05 °C·m²·h/kJ

  R₂ = 0.120 2.8 = 3/70 °C·m²·h/kJ

  R₃ = 0.05/0.25 = 0.2 °C·m²·h/kJ

  R₄ = 0.003/240 = 1.25×10⁻⁵ °C·m²·h/kJ

So, the total thermal resistance is ...

  R₁ +R₂ +R₃ +R₄ = R ≈ 0.29286 °C·m²·h/kJ

__

The rate of heat loss is ΔT/R = (1450 -90)/0.29286 = 4643.70 kJ/(m²·h)

__

The temperature drops across the various layers will be found by multiplying this heat rate by the thermal resistance for the layer:

  fire brick: (4543.79 kJ/(m²·h))(0.05 °C·m²·h/kJ) = 232 °C

so, the fire brick interface temperature at the common brick is ...

  1450 -232 = 1218 °C

For the next layers, the interface temperatures are ...

  common brick to magnesia = 1218 °C - (3/70)(4643.7) = 1019 °C

  magnesia to steel = 1019 °C -0.2(4643.7) = 90.06 °C

_____

<em>Comment on temperatures</em>

Most temperatures are rounded to the nearest degree. We wanted to show the small temperature drop across the steel plate, so we showed the inside boundary temperature to enough digits to give the idea of the magnitude of that.

5 0
2 years ago
Other questions:
  • Why research and development in Maintenance Engineering?
    6·1 answer
  • Estimate the quantity of soil to be excavated from the borrow pit​
    12·1 answer
  • 1. How many types of pumps are present?​
    14·1 answer
  • A force that attempts to decrease the length of a structural member is____
    14·1 answer
  • The gas-turbine cycle of a combined gas–steam power plant has a pressure ratio of 8. Air enters the compressor at 290 K and the
    15·1 answer
  • Question 3. Assign boston_under_10 and manila_under_10 to the percentage of rides that are less than 10 minutes in their respect
    14·1 answer
  • If the power to a condensing unit has been turned off for an extended period of time, the _________________________ should be en
    12·1 answer
  • What differentiates the master builder approach prior to the Renaissance from later approaches? Projects do not depend on indivi
    14·1 answer
  • A lightbulb has a fixed negative and positive connector. You cannot swap positive and negative sides of a lightbulb in a circuit
    9·2 answers
  • Explain the problems and their possible solution for electricity problems ?​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!