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
Assoli18 [71]
3 years ago
13

Write a program that reads from the user any three points in two dimensional space: x1, y1, x2, y2, x3, y3. Assume these points

form a line segment, (x1, y1) to (x2, y2) to (x3, y3). Calculate the sum of these line segments and print value to two decimal places.For example with points (0.0, 0.0), (3.0, 4.0), (6.0, 8.0), the distance for the first segment is 5.0, the second segment is 5.0, so the output for this case would be 10.00. The input and output for this case would be:INPUT:0.0 0.03.0 4.06.0 8.0OUTPUT: 10.00
Computers and Technology
1 answer:
netineya [11]3 years ago
6 0

Answer:

The solution code is written in Python:

  1. import math  
  2. coord= input("Enter coordinates for three points: ")
  3. coordList = coord.split(" ")
  4. for i in range(0, len(coordList)):
  5.    coordList[i] = float(coordList[i])
  6. seg_1 = math.sqrt((coordList[0] - coordList[2])**2 + (coordList[1]- coordList[3])**2)
  7. seg_2 = math.sqrt((coordList[2] - coordList[4])**2 + (coordList[3]- coordList[5])**2)
  8. print(seg_1 + seg_2)

Explanation:

Firstly, we can use Python built-in method <em>input()</em> to get coordinates for three points from user (Line 3). To simplify the entry process, the input of the three coordinates is expected in a single string 0.0 0.0 3.0 4.0 6.0 8.0O. Please note each of the coordinates is separated by a single space.

Next, we can proceed to use Python string split() method and single space character " " as separator to break the input string of coordinates into a list of individual numbers ["0.0", "0.0", "3.0", "4.0", "6.0", "8.0"].

Prior to calculating the line segment, it is important to ensure the coordinates in the list,<em> coordList</em>, have been converted from string to float type (Line 6 - 7).

Next, we are ready to apply the Distance formula to calculate the length of the two line segments that join the three coordinates (Line 9 and Line 11).  The distance formula is \sqrt{ (x1 - x2){^2}  +  (y1 - y2){^2}   }

At last, sum up the two line segments, <em>seg_1 </em>& <em>seg_2 </em>and print it in the terminal (Line 13).

You might be interested in
Suppose you want to view a document that has several headings. what view would you use?
bija089 [108]
Um i think outline. :)
5 0
3 years ago
Isabella's manager has asked her to write up a _____ that describes their company's interest in developing a custom software sol
kakasveta [241]

Answer:

Request for information (RFI)

Explanation:

Request for Information is a business process document that contains information about an organization's capability to deliver solutions to a potential client. The RFI document will contain information that will help for decision making by clients. Other similar business documents in this line are Request for tender (RFT), request for quotation (RFQ).

6 0
3 years ago
Is a procedure to copy one or more files from backup media to the original disk or a replacement disk when data or programs have
Stels [109]
Restore is a procedure to copy one or more files from backup media to the original disk or a replacement disk when data or programs have been erased or destroyed.
4 0
3 years ago
It is important to use as much text as possible in a presentation. <br> a. True<br> b. False
Kryger [21]
False. You should have little text and lots of pictures, because you are the one who should be doing the explaining, not the presentation.
4 0
3 years ago
the graph at left in the tctct, c-plane models the global wind power capacity, ccc, in gigawatts, ttt years since 199619961996.
Elena-2011 [213]

The intercept of a graph is the point where the graph crosses the axes of the graph.

The interpretation of the c-intercept is: <em>in 1996, the global wind power capacity was approximately 7 gigawatts.</em>

On the graph (see attachment), we have the following observations

  1. The vertical axis represents the global wind power capacity (i.e. the c-axis)
  2. The horizontal axis represents the years since 1996 (i.e. the t-axis)

So, the c-intercept is the point that crosses the vertical axis.

From the graph, the curve crosses the c-axis at c = 7, and t = 0 (i.e. years = 1996)

Hence, the interpretation of the c-intercept is: <em>in 1996, the global wind power capacity was approximately 7 gigawatts.</em>

<em />

<em />

Read more about intercepts at:

brainly.com/question/3334417

4 0
2 years ago
Other questions:
  • Assume that getPlayer2Move works as specified, regardless of what you wrote in part (a) . You must use getPlayer1Move and getPla
    14·1 answer
  • Question: Henry wants to change the configuration information of an application. Which file should Henry edit to change this inf
    15·1 answer
  • A user is claiming a host can be reached via the IP address but not through the name. What should a technician do first to resol
    13·1 answer
  • What sugar is used in a DNA molecule​
    7·2 answers
  • What is the difference between a software engineer and a system analyst?
    8·1 answer
  • Which of the following is not part of the processes involved in data valida
    11·1 answer
  • What common variation of the Server Message Block (SMB) sharing protocol is considered to be a dialect of SMB?
    11·1 answer
  • Hi everyone can anyone tell me how to align the photo the right in code.org
    8·1 answer
  • Match each type of video camera to its features:
    15·1 answer
  • What does playstation network is currently undergoing maintenance?.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!