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]
3 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]3 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
Good reasons to be informed of your GPA include all of the following except
Illusion [34]
Auto insurance companies offer discounts if you are good student, or full time student (which includes your gpa).

grants and scholarships are rewarded by good grades and succession of essay writing.

students will get kicked off their athletic team if their GPA is too low.

That singles out comparing yourself to your friends, which should be obvious that this one's excluded. ☺
6 0
3 years ago
Read 2 more answers
Where in the world, other than Newfoundland, is
Naya [18.7K]

Answer:

-India, Iran, Afghanistan, Myanmar, Sri Lanka, the Marquesas, as well as parts of Australia use half-hour deviations from standard time, and some nations, such as Nepal, and some provinces, such as the Chatham Islands of New Zealand, use quarter-hour deviations.

-This has largely to do with the politics in each of those places. For example, in New Delhi, India, they found themselves halfway between two meridians, and therefore decided to be 30 minutes between each, as opposed to adopting one time or the other

Meridians - a circle of constant longitude passing through a given place on the earth's surface and the terrestrial poles.

7 0
3 years ago
In what ways were the middle colonies more open and diverse than New England?
Pie

Democratic colonies is the answer

4 0
4 years ago
RESPETAR LA CAPACIDAD DE CARGA DE UN DESTINO, LE ALARGA LA VIDA UTIL.
Stolb23 [73]

Explanation:

hope it helps

brainliest please ❤

4 0
3 years ago
Describe an example of a technology or team and technology interaction that you have had in the context
r-ruslan [8.4K]
When you have to call ur parents?
8 0
4 years ago
Other questions:
  • You will be asked to provide all of the following personal information as part of your college application except:
    12·2 answers
  • Members of some hate groups cover their faces and sometimes their entire bodies while they mistreat their targeted group. This c
    6·1 answer
  • AP WORLD HISTORY!!!!
    13·1 answer
  • Yyyyygggttttyggggggggvgvvvbbb. Bbbvggggggg
    9·2 answers
  • The first one wants u to download a file somewhere-DO NOT DOWNLOAD IT OR GO TO THE WEBSITE!!!
    8·1 answer
  • Two type of microscopes used to view cells are optical and__ microscopes
    11·1 answer
  • Which program requires concurrent enrollment?
    15·1 answer
  • Logic gate<br> Y = 1 if (A = 0 AND B = 0) AND (B = 0 OR C = 1)<br><br> Please help, please help mee
    11·1 answer
  • Were is <br> PYGRO at so we can talk
    13·1 answer
  • Give an example of a group of people that had to adapt (change) the way they lived
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!