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
rosijanka [135]
2 years ago
8

Two lights will be arranged on a two-dimensional plane. The vertical distance between the two lights is stored in the double var

iable a. The
horizontal distance between the two lights is stored in the double variable b.

The straight-line distance between the two lights is given by the formula

ſa² +b²

Write a code segment that prints the straight-line distance between the two lights according to the formula above.
Advanced Placement (AP)
1 answer:
lbvjy [14]2 years ago
6 0

Answer:

double a;

double b;

double distance = Math.sqrt( (Math.pow(a, 2) + Math.pow(b, 2));

System.out.println("The distance is: " + distance);

Explanation:

The code snippet is written in Java.

First, variable a is declared as a type of double and variable b is also declared as a type of double.

The given formula for the distance is:

√(a² + b²)

So we use the inbuilt function of Java to calculate the power and the square root.

Math.sqrt is to find the square root and it returns a value of type double.

Math.pow is use to calculate the value of a² and b².

a² = Math.pow(a, 2)

b² = Math.pow(b, 2)

Then Math.sqrt is applied to the sum of Math.pow(a, 2) and Math.pow(b, 2), the value is assigned to distance of type double.

The value of distance is now displayed to the user:

System.out.println("The distance is: " + distance);

You might be interested in
What reasons are there for declining birth rates?
o-na [289]
Condom Brothers is the correct answer
5 0
3 years ago
Why is it hard to set static boundaries for regions?
Masja [62]
Different populations will have different viewpoints on the boundaries (most likely bad viewpoints)
4 0
2 years ago
Particle x moves along the positive x-axis so that its position at time t ~ 0 is given by x(t) = 5t 3 - 9t 2 + 7. at what time t
Arada [10]

Answer: 1.2 seconds

Explanation:

$$At the farthest point the velocity of particle will be zero. \ Differentiating the given equation of position and equating it with zero:$$\begin{aligned}x(t) &=5 t^{3}-9 t^{2}+7 \\x^{\prime}(t) &=15 t^{2}-18 t \\0 &=15 t^{2}-18 t \\t(15 t-18) &=0 \\t &=0 \\t &=\frac{18}{15}=1.2 \mathrm{~s}\end{aligned}$$

$$Thus, at $t=1.2 \mathrm{~s}$ particle will be at the farthest point. \\\\\underline{Justification:}\\The particle moves towards the left from $t \in[0,1.2)$. After that particle keeps moving in  the positive x-direction.

5 0
1 year ago
Can anyone answer my question i posted please / thank you
iVinArrow [24]
Need questions so we can answer it
5 0
2 years ago
A rectangle has a perimeter of 20 inches and an area of 24 square inches. What are the length and width of the rectangle?
s2008m [1.1K]
Perimeter = 2(L + W) = 20 or L + W = 10

And Area = L x W = 24

So with have the SUM "S" of 2 numbers and te PRODUCT "P' of same numbers, then

we can apply te quadratic equation X² -SX + P

X² - 10X + 24 = 0, solve this equation and you'll find L = 6 in and W = 4in

 or 4 in x 6 in
8 0
3 years ago
Other questions:
  • Violating a penal code is a violation of what type of law?
    7·1 answer
  • How much money should be invested now (rounded to the nearest cent), called the initial investment, in a Treasury Bond investmen
    10·1 answer
  • If a hexagon has a side length of 10 what is the area of the hexagon?
    10·1 answer
  • Which instrument family do you think the shakuhachi belongs to?
    14·1 answer
  • How would you describe environmental possiblism
    13·1 answer
  • Do wavelength and frequently have a direct or an inverse relationship ??
    11·1 answer
  • Which of the following is NOT permitted in a roundabout?
    10·2 answers
  • The pegboard system can be described as?
    10·1 answer
  • A teacher has recieved false information that one of your friends is a cheater. Explain how each if the following can lead the t
    5·1 answer
  • Should we notify the physician of the patient's state? Why or why not?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!