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
What kind of value should an employee possess when employees are expected to be responsible and fair?
jasenka [17]

Answer:

E self-confidence

Explanation:

6 0
3 years ago
A long corridor has a single light bulb and two doors with light switch at each door.
Zigmanuir [339]

Answer:

The answer is below

Explanation:

Let A represent the first switch, B represent the second switch and C represent the bulb. Also, let 0 mean  turned off and 1 mean turned on. Since when both switches are  in the same position, the light is off. This can be represented by the following truth table:

A                    B                       C (output)

0                    0                        0

0                    1                          1

1                     0                         1

1                     1                          0

The logic circuit can be represented by:

C = A'B + AB'

The output (bulb) is on if the switches are at different positions; if the switches are at the same position, the output (bulb) is off. This is an XOR gate. The gate is represented in the diagram attached below.

6 0
3 years ago
ANSWER FAST PLEASE!!! WILL MARK BRAINLIEST!!!!!!
Phoenix [80]

Answer:

Phuong works on a research project and creates a report for her boss.

5 0
3 years ago
Read 2 more answers
A gasoline engine has a piston/cylinder with 0.1 kg air at 4 MPa, 1527◦C after combustion, and this is expanded in a polytropic
Roman55 [17]

Answer:

The expansion work is 71.24 kJ and heat transfer is -16.89 kJ

Explanation:

From ideal gas law,

Initial volume (V1) = nRT/P

n is the number of moles of air in the cylinder = mass/MW = 0.1/29 = 0.00345 kgmol

R is gas constant = 8314.34 J/kgmol.K

T is initial temperature = 1527 °C = 1527+273 = 1800 K

P is initial pressure = 4 MPa = 4×10^6 Pa

V1 = 0.00345×8314.34×1800/(4×10^6) = 0.013 m^3

V2 = 10×V1 = 10×0.013 = 0.13 m^3

The process is a polytropic expansion process

polytropic exponent (n) = 1.5

P2 = P1(V1/V2)^n = 4×10^6(0.013/0.13)^1.5 = 1.26×10^5 Pa

Expansion work = (P1V1 - P2V2) ÷ (n - 1) = (4×10^6 × 0.013 - 1.26×10^5 × 0.13) ÷ (1.5 - 1) = 35620 ÷ 0.5 = 71240 J = 71240/1000 = 71.24 kJ

Heat transfer = change in internal energy + expansion work

change in internal energy (∆U) = Cv(T2 - T1)

T2 = PV/nR = 1.26×10^5 × 0.13/0.00345×8314.34 = 571 K

Cv = 20.785 kJ/kgmol.K

∆U = 20.785(571 - 1800) = -25544.765 kJ/kgmol × 0.00345 kgmol = -88.13 kJ

Heat transfer = -88.13 + 71.24 = -16.89 kJ

5 0
3 years ago
Which one is suitable for industries petrol engine or diesel engine and why?
klio [65]

Answer:

diesel engine

Explanation:

because diesel is stronger than petrol

3 0
3 years ago
Read 2 more answers
Other questions:
  • Nicholas wants to verify whether a file is a hard link to a file within the same directory. Which of the following commands coul
    6·1 answer
  • CNG is a readily available alternative to
    5·1 answer
  • a vehicle is in her repair with a complaint at for heating output during testing and diagnosing air is found to be trapped in th
    15·1 answer
  • A(n) _________ is a current greater than the equipment rated current or conductor ampacity, which is confined to the normal cond
    12·1 answer
  • An engineer is considering time of convergence in a new Layer 3 environment design. Which two attributes must be considered? (Ch
    15·1 answer
  • Realize the function f(a, b, c, d, e) = Σ m(6, 7, 9, 11, 12, 13, 16, 17, 18, 20, 21, 23, 25, 28)using a 16-to-1 MUX with control
    13·1 answer
  • Write Python expressions using s1, s2, and s3 and operators and * that evaluate to: (a) 'ant bat cod'
    14·1 answer
  • Think about the science you have studied in the past or are currently studying. Give an example of something you have learned in
    11·1 answer
  • What is the difference between class 1 and class 3 lever?
    8·2 answers
  • Consider the function f(n) = n
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!