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
Which transmission media is faster? Fibre Optic or Radio-waves? I want full explanation!
Bad White [126]

Answer:

Due to the direct line of sight,the data rate of radio links is higher than that of fiber optic connections. A radio link has a lower latency (less delay).In contrast ,fiber optic connections may achieve higher bandwidths

4 0
4 years ago
Www.microsoft.com is an example of this (two words) (last letter is e) and has to be (10 letters)
a_sh-v [17]

Answer:

domain name (2 words, 10 letters)

6 0
3 years ago
Which would a student most likely do in a digital laboratory?
Ainat [17]

Answer: conduct an experiment in chemistry.

Explanation:

6 0
3 years ago
Read 2 more answers
You want to multiply 50 in cell D3 by 8.90 in cell E3. Which formula should you use?
Effectus [21]

Answer:

The formula is =D3*E3

Explanation:

To multiply the items in 2 cells, the formula like every other in excel begins with = .

to multiply 50 in cell D3 by 8.90 in cell E3 the formula to be used is

=D3*E3

This will multiply the numbers in both cell and show as 445.

7 0
4 years ago
How to divert all calls &amp; sms from other phone to my phone? is it possible?
gayaneshka [121]
<h2>Answer:</h2>

It is possible in case of calls. SMS cannot be diverted to other numbers.

<h2>Explanation:</h2>

Every mobile manufacturing company has its own settings features and every cellular network has its own codes yet the facility of call forwarding which is a phone feature that enables users to forward or redirect incoming calls to any alternate number, which may be either a land line or cellular number. This facility can be availed by going to the Setting menu, then call setting and looking for call forwarding option. Once you get to the call forwarding option, select the destination number where you can divert the calls received on your number. Unfortunately sms cannot be diverted.

4 0
4 years ago
Other questions:
  • While investigating the settings on your SOHO router, you find two IP addresses reported on the device’s routing table, which is
    15·1 answer
  • What are the advantages and disadvantages of using thermoset plastics
    14·1 answer
  • Define the missing method. licenseNum is created as: (100000 * customID) + licenseYear. Sample output: Dog license: 77702014
    14·1 answer
  • What process does a system use to officially permit access to a file or a program CIS 502 ?
    11·1 answer
  • What is an IP address and where I can find the IP address for my computer?
    14·1 answer
  • Which of the following skills do employers in any field expect their employees<br> to have?
    5·1 answer
  • If the larger gear is the
    15·1 answer
  • HTML question please help
    5·1 answer
  • Daniel has a list of numbers that are not in any order. He wants to find the order of the numbers with the help of a spreadsheet
    10·1 answer
  • Consider a student club or organization in which you are a
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!