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
DaniilM [7]
3 years ago
9

Write a method called compFloat5 which accepts as input two doubles as an argument (parameter). Write the appropriate code to te

st the two numbers up to five decimal points to see if they are close enough. If they are close enough return true else return false. This would be a Boolean value. f. Write a method called compInt which accepts as input two integers as an argument (parameter). Write the appropriate code to test the two integers to see if they are equal. If they are equal return true else return false. This would be a Boolean value. g. Write a method called stringEqual program that reads in two sentences as an argument (parameter). Write the appropriate code to test the two strings to see if they are the equal. If they are equal return true
Engineering
1 answer:
Umnica [9.8K]3 years ago
4 0

Answer:

public class Comparision {

public boolean compFloat5(double d1, double d2) {

// Rounding off to two decimal places

d1 = (Math.round(d1 * 100000) / 100000.00);

d2 = (Math.round(d2 * 100000) / 100000.00);

if (d1 == d2)

return true;

else

return false;

}

public boolean compInt(int int1, int int2) {

if (int1 == int2)

return true;

else

return false;

}

public boolean stringEqual(String s1, String s2) {  

if (s1.equals(s2))

return true;

else

return false;

}

public boolean stringCompare(String s1, String s2) {

int i = s1.compareTo(s2);

if (i == -1)

return true;

else  

return false;

}  

}

You might be interested in
Cold water (cp = 4180 J/kg·K) leading to a shower enters a thin-walled double-pipe counterflow heat exchanger at 15°C at a rate
Arturiano [62]

Answer:

The rate of heat transfer is  H = 31.35\  kW

The heat transfer surface area is  A_s = 0.4818 m^2

Explanation:

From the question we are told that  

          The  specific heat of water is cp = 4180 \ J/kg \cdot K

           The temperature of cold water is T_c = 15^o C

            The rate of cold the flow is \r m = 0.25 kg/s

           The temperature of the heated water T_h = 45 ^oC

            The specific heat of hot water is  c_p__{H}} = 4190 J/kg \cdot K

              The temperature of the hot water is T_H = 100^oC

               The rate of hot the flow is \r m_H = 3 kg/s

               The heat transfer coefficient is U = 950 W/m^2 \cdot K,

From the \epsilon -NTU method we have that

       C_h  = \r m_H c_p__{H}}

Where C_h is the heat capacity rate of hot  water

      Substituting the value

            C_h = 3 * (4190)

                 = 12,5700\ W/^oC

Also

      C_c = \r m c_p

Where C_c is the heat capacity rate of cold  water

        C_c = 0.25 * 4180

              = 1045 \ W / ^oC

The maximum heat capacity C_h and the minimum  heat capacity is C_c

       The maximum heat transfer is

                H_{max}  =  C_c (T_H - T_c)

Substituting values  

               H_{max} = (1045)(100- 15)

                          = 88,825\  W

The actual heat transfer is mathematically evaluated as

               H = C_c (T_h - T_c)

Substituting values

               H = 1045 (45 - 15 )

                    H = 31350 \ W

                    H = 31.35\  kW

The effectiveness of the heat exchanger is mathematically evaluated as

             \epsilon = \frac{H}{H_{max}}

  Substituting values  

           \epsilon = \frac{31350}{88,825}

              = 0.35

The NTU of the heat exchanger is mathematically represented as

          NTU = \frac{1}{C-1} ln [\frac{\epsilon - 1}{\epsilon C -1} ]

Where C is the ratio of the minimum to the maximum heat capacity which is mathematically represented as

             C = \frac{C_c}{C_h}

Substituting values

             C = \frac{1045}{12,570}

                 = 0.083

Substituting values in to the equation for NTU

         NTU = \frac{1}{0.083 -1} ln[\frac{0.35 - 1}{0.35 * (0.083 - 1)} ]

                   = 0.438

Generally the heat transfer surface area can be mathematically represented as

         A_s = \frac{NTU C_c}{U}

Substituting values

          A_s = \frac{(0.438) (1045)}{950}

              A_s = 0.4818 m^2

5 0
3 years ago
In dynamics, the friction force acting on a moving object is always a) in the same direction of its motion b) a kinetic friction
FrozenT [24]

Answer:

B) a kinetic friction

Explanation:

 The force of friction in a movement object its called kinetic friction force (<em>fk).              </em>The net force acting in the direction of the movement its express, according to the Newton second law, like this: F- <em>fk. </em>That expression says that the net force produces an aceleration in the direction of the movement of the object.

 Now if the force its removed, the <em>fk</em> its continue acting in the object but now in the opposite direction. And according to the Newton second law this <em>fk </em>it going to continue acting until the object stay in a still state.

  <u>In conclusion</u>, if an object moves in some direction the kinetic friction force always be opposite to that direction of movement, according to the Newton second law

6 0
3 years ago
What learning is required to become a mechanical engineer?
Vinvika [58]

bachelor's degree in mechanical engineering or mechanical engineering technology

3 0
3 years ago
Consider the gas carburizing of a gear of 1018 steel (0.18 wt %) at 927°C (1700°F). Calculate the time necessary to increase the
Artyom0805 [142]

Answer:

t = 56.6 min

Explanation:

Fick's second law is used to calculate time required for diffusion

\frac{C_s - C_x}{C_s - C_o} =  erf( \frac{x}{2\sqrt{Dt}})

where

C_s= 1.15%

C_o = 0.18%

C_x= 0.35%

x = 0.40 mm = 0.0004 n

D_{927^O\ C } = 1.28\times 10^{11} m^2/s

therefore we ahave

\frac{1.15-0.35}{1.15- 0.18} =  erf[\frac{4\times 10^{-4}}{2\sqrt{1.28\times 10^{-11} t}}]

0.8247 = erf [\frac{55.90}{\sqrt{t}}] =  erf z

from error function table we hvae following result

for erf z                          z

     0.8209                      0.95

      0.8247                   x

      0.8427                    1

therefore

\frac{0.8247 - 0.8209}{0.8427 - 0.8209} = \frac{x - 0.95}{1 - 0.95}

x = 0.959

thus

z = \frac{55.90}{\sqrt{t}}

0.959 = \frac{55.90}{\sqrt{t}}

t = 56.6 min

5 0
3 years ago
The slope of a moment diagram is the load. a)-True b)-False
Alex17521 [72]

Answer:

true.

Explanation:

but i am not 100% sure

8 0
3 years ago
Other questions:
  • Which of the following is an example of an iterative process?
    12·1 answer
  • The in situ moisture content of a soil is 18% and the moist (total) unit weight is 105 pcf. The soil is to be excavated and tran
    9·1 answer
  • A 6-pole, 50 Hz squirrel cage induction motor has rotor resistance and standstill reactance referred to stator of 0.2 ohm and 1
    7·1 answer
  • One cubic meter of nitrogen at 40°C and 340kPa is compressed isoentropically to 0.2m^3. Calculate the final pressure when the ni
    9·1 answer
  • Define ways in which you would go about networking to explore opportunities in your career field and obtain more information for
    11·1 answer
  • Three consequences of unbalanced wheels on a motor vehicle​
    11·1 answer
  • How do i do this? if y’all don’t mind helping lol
    13·1 answer
  • A demand factor of _____ percent applies to a multifamily dwelling with ten units if the optional calculation method is used.
    14·1 answer
  • Please help been stuck on this for a couple minutes
    5·1 answer
  • 10. True or False? A disruptive technology<br> radically changes the way people live and<br> work.
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!