Write a program to find distance between the two points

Assignment Help C/C++ Programming
Reference no: EM131422108

Assignment- Arrays and Parallel Arrays

Introduction

In this assignment you will write a small C program. Your program should compile correctly and produce the specified output.

Please note that the computer program should comply with the commenting and formatting rules as has been done in class. For example, there should be a header for the whole program that gives the author's name, class name, date, and description. End braces should be commented, and there are alignment and indenting requirements as discussed. Please ask if you have any questions.

Program #1

Given the following list of point coordinates and label:

Point Label

X-Coordinate

Y-Coordinate

A

50.2

75.8

B

45.7

48

C

76.7

99.1

D

12

14

F

-25

48

G

23

-36

Table 1: Point Information

The information is given as three arrays:

i) A char array named point_label, for column 1 in Table 1
ii) A double array named x_coord, for column 2 in Table 1
iii) A double array named y_coord, for column 3 in Table 1

The table information can be hard coded.

Given two points, entered using the labels (i.e. A and B), the program will compute:

a) The distance between the two points
b) The equation of the line crossing these points in the form: y = mx+k
c) The closest perpendicular point to the line described by the two points given.

The distance from a point P0(x0,y0) to a line in the form ax+by+c=0 , is defined as:

distance (ax+by+c=0, P0) = |ax0+by0+c| / √(a2+b2)

Where a and b are not both zero.

Introduction to Programming Assignment: Arrays and Parallel Arrays

The program should display a menu (10 points) with the following options:

a) Enter points (5 points)
b) Compute the distance (20 points)
c) Display the line equation (25 points)
d) Find the closest point to the line in c)(35 points)
e) Exit

The program will finalize ONLY when option e) is chosen. (5 points)

Deliverables

You will turn in two files, a C source code file, and text file with an example of the program output and any special instruction to run your program.

The C source code file should:

1) Comply with all of the formatting requirements already discussed.
2) Query the user(input)
3) Display the output
4) Perform the operations described.

Reference no: EM131422108

Questions Cloud

Describe the fertilization process : You are asked to describe the fertilization process. Explain how the sperm travels from the testes and arrives at the fallopian tube in time to meet the ova.
Describe sampling distribution model of mean fuel economy : Write appropriate hypotheses.- Are the necessary assumptions to make inferences satisfied?- Describe the sampling distribution model of mean fuel economy for samples like this.
Identify and briefly explain the underlying technologies : For two of the applications presented in Part 1, you are to identify and briefly explain the underlying technologies, recognise any difficulties in the delivery of the service and briefly describe how those difficulties are overcome
How is biotechnology used in every day life : What are some examples of biotechnology and how is biotechnology used in every day life?
Write a program to find distance between the two points : CS1325- Write a program to find distance between the two points. The equation of the line crossing these points in the form: y = mx+k. The closest perpendicular point to the line described by the two points given.
Find mean and standard deviation of observed weights : Do these data satisfy the assumptions for inference? Explain.- Find the mean and standard deviation of the observed weights.- Create a 95% confidence interval for the mean weight of such bags of chips.
How clinical applications can support quality management : Discuss how clinical applications can support quality management and cost control programs in health care. Give an example of at least 2 clinical applications.
Acceptable macronutrient distribution range : Why is the Acceptable Macronutrient Distribution Range important to consider when assessing your dietary intake?
Find the mean and standard deviation of the observed weights : Do these data satisfy the assumptions for inference? Explain.- Find the mean and standard deviation of the observed weights.

Reviews

Write a Review

 

C/C++ Programming Questions & Answers

  Create a class called point3d

Create a class called Point3D to represent 3D point in space, a class called Sphere and a class called Cylinder. The sphere is characterized by its center point and the radius while the Cylinder can be characterized by its center point, radius and he..

  How efficiently did you search for existing words

Do you strip punctuation and convert each word to lowercase? Are the frequencies correct? What approach did you take to store data (vectors, arrays, repeats)? How efficiently did you search for existing words?

  Write c program that outputs success positive float values

Look for the float.h include file on the system that hosts the C compiler that you use. What is the value for FLT_MANT_DIG, the number of significant digits that a float variable can have? Write a C program that outputs successively smaller positi..

  Write cpp code to open a document with the name hello-txt

Write C++ code to open a document with the name Hello.txt, place the message "Hello, World!" in the document, and exit the document. Re open the file you closed, and read the message into a string variable.

  Write a program named averages

Write a program named Averages that includes a method that accepts any number of numeric parameters, displays them, and displays their average.

  Test all the memeber function and overloaded operators

Write a program to test all the memeber function and overloaded operators in your class definition.

  What is the :: called in c++

What is the :: called in C++ when used like this std::endl; In my main file, what line of code prevents me from having to put std before every endl

  Design how to do the logic in your own words first

Design how to do the logic in your own words first. Do not even think about C until you understand the true false logic and the arithmetic needed to do it. Make sure you have a formula or a plan to calculate each case.

  Find the radius of the circle

The program should then output the circle's radius, circumference, diameter, and area. Your program must have at least the given methods - Find the radius of the circle, and returns the circle's radius.

  Statement that best describes bayesian reasoning

what is the equation of that separates the two classes - Select the statement that best describes BAYESIAN reasoning

  Write a recursive function to draw the pattern

write a program that prompts the user to enter the number of lines in the pattern and uses the recursive function to generate the pattern. For example, specifying 4 as the number of lines generates the above pattern.

  Design a system using a class called books

Design a system using a class called Books with suitable members

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd