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 sensitivity level is not a default available in Outlook 2016?
vichka [17]

Answer:

Company only

Explanation: The sensitivity levels available for Outlook 2016 are Normal, personal,private and confidential, this sensitivity levels helps users to the intentions of the user of the product and it will help to give their plan on what and how to utilize the product. It is very important to make use of the sensitivity levels in your Outlook for better usage of the Microsoft Outlook.

6 0
3 years ago
Read 2 more answers
Having reviewed dod wireless stig (ver6, release 1), sarah learns she may only utilize secnet 54 and ______________ for transmit
xeze [42]
<span>Sarah learns she may only utilize SecNet 54 and SecNet 11 for transmitting classified information up to top secret.
</span>

SecNet 11 Plus is a family of encrypted <span>802.11b wi-fi <span>networking products. The Army has also approved</span></span> SecNet 11<span> as part of the classified Navy Marine Corps Intranet (NMCI) wireless solution. There are many products in SecNet 11 family, such as SecNet 11 Plus PC card, the SecNet 11 Wireless ridge, and the SecNet 11 Key Fill Cable etc.</span>

7 0
3 years ago
Please help!
Darya [45]
The answer would be A.) Web pages provide information, while web applications allow the user to do something. a web page is for relaying information. (you can relate this to a book. a page in a book gives you information.) while an application allows you to perform an action.
4 0
3 years ago
Read 2 more answers
Given an int variable n that has been initialized to a positive value and, in addition, int variables k and total that have alre
Fudgin [204]

Answer:

The c++ program to implement the while loop is given below.

#include <iostream>

using namespace std;

int main() {

  // declaration of integer variables

   int k, n, total;

   // initialization of integer variables

   k=1, n=4, total=0;

//  loop executed till value of k becomes equal to value of n

   while( k <= n ){

       // cube of every integer is added to the variable total

       total = total + ( k * k * k );

       // value of k is incremented to go to the next number

k = k + 1 ;

   }  

   return 0;

}  

Explanation:

The program begins with the declaration of integer variables.  

int k, n, total;

This is followed by initialization of these variables.

k=1, n=4, total=0;

The while loop runs over the variable k which is initialized to 1. The loop runs till value of k reaches the value of integer n.

First, cube of k is computed and added to the variable total.

After first execution of the loop, total is initialized to the cube of 1.

Next, value of variable k is incremented by 1 so that k is initialized to next integer.

After first execution of the loop, k is incremented from 1 to 2.

while( k <= n )

{

total = total + ( k * k * k );

k = k + 1 ;

   }

When the value of k reaches the value of integer n, the cube of n is calculated and added to the variable, total.

When k is incremented, it becomes more than n and hence, loop gets terminated.

As the return type of main is int, the program terminates with the statement shown below.

return 0;

No output is displayed as it is not mentioned in the question.

No user input is taken as it is mentioned that integer variables are already initialized.

4 0
3 years ago
Canadian Tire is one of Canada’s largest companies. They operate four large distribution centers service over 470 tire retail ou
olganol [36]

Answer: Provided in the explanation section

Explanation:

A YMS acts an interface between a WMS and TMS.The evaluation system with the key performance indicators are mentioned in the table below.

NOTE: The analysis follows in this order given below

  • Metric
  • Description
  • Comments

Metric 1

<u>Trailer utilization</u>

Description :This captures the status of the trailer whether it is in the yard or is in transit

Comments : Helps in measuring the trailer productivity on a daily ,weekly or monthly basis

Metric 2

<u>Driver utilization</u>

Description : This captures the status of the driver whether the driver is in the yard or is in transit

Comments : Helps in measuring the driver productivity on a periodic basis

Metric 3

<u>Trailer sequence</u>

Description : This captures the order of movement of trailers in the yard on a given day, week or month

Comments : Helps in measuring the order fulfilment efficiency i.e. whether the priority orders have been serviced first or not

Metric 4

<u>Total time in yard</u>

Description : This captures the time spent by the trailer in the yard from the time it enters and leaves the yard

Comments : This helps in measuring the time taken to fulfill a particular request

⇒ Capturing these metrics need inputs from both WMS and TMS, and also the trailers need to have RFID tags attached to them.Then compare these performance metrics with the ones prior to the deployment of YMS to identify the percent gains in the overall operational productivity.

cheers i hope this helped !!

8 0
3 years ago
Other questions:
  • The_provides access to the internet may also be internal​
    9·1 answer
  • If you want to copy text formatting from one area of your document to another area, _____.
    5·2 answers
  • Plot element is typically the turning point in the most intense moment of a story
    8·1 answer
  • Which word goes with "meals
    5·2 answers
  • I can't find the errors! Could anyone help me please?!
    5·1 answer
  • Write the WordSandwich method allSandwiches. This method creates and returns a new array of String objects as follows. Each elem
    13·1 answer
  • Describe two types of storage devices?​
    15·1 answer
  • When we code an algorithm, we need to provide the commands in the order we want the
    10·1 answer
  • The term structure, as it relates to programming, refers to the decisions you make to design your program to best meet its objec
    11·1 answer
  • A(n) __________ structure is a structure that causes a statement or a set of statements to execute repeatedly.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!