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
sladkih [1.3K]
3 years ago
6

In this exercise, you will write a Point structure that represents a space in two-dimensional space. This Point should have both

x and y elds (please use these exact names). You will also write three functions for dealing with Points; freadPoint, manhattanDistance, and euclideanDistance. freadPoint should take in a FILE handle and a Point (by reference) that it will initialize; it should not do any prompting. It will return true if it succeeds in reading a point and false if it fails. Each point will be a line in the le, with the x and y coordinates separated by spaces. A sample input le, point29.txt has been included. The manhattanDistance function will take two Points and compute the Manhattan distance (city block distance) between them, which is the distance that you would travel if you are restricted to walking parallel to either the x or y axes. Likewise, the euclideanDistance function will take two Points and compute the Euclidean distance (straight-line distance) between them. Neither function prints anything; they simply return a value. Your main function will prompt the user to enter two points and then display the Manhattan and Euclidean distances. You should call each of your functions (using stdio as a parameter to freadPoint) to do so. You may want to use the fabs and sqrt functions to help you with this assignment

Engineering
1 answer:
Afina-wow [57]3 years ago
8 0

Answer:

Check the explanation

Explanation:

Points to consider:

We need to take the input from the user

We need to find the manhatan distance and euclidian using the formula

(x1, y1) and (x2, y2) are the two points

Manhattan:

|x_1 - x_2| + |y_1 - y_2|

Euclidian Distance:

\sqrt{(x1 - yl)^2 + (x2 - y2)^2)}

Code

#include<stdio.h>

#include<math.h>

struct Point{

  int x, y;

};

int manhattan(Point A, Point B){

  return abs(A.x - B.x) + abs(A.y- B.y);

}

float euclidean(Point A, Point B){

  return sqrt(pow(A.x - B.x, 2) + pow(A.y - B.y, 2));

}

int main(){

  struct Point A, B;

  printf("Enter x and Y for first point: ");

  int x, y;

  scanf("%d%d", &x, &y);

  A.x = x;

  A.y = y;

  printf("Enter x and Y for second point: ");

  scanf("%d%d", &x, &y);

  B.x = x;

  B.y = y;

  printf("Manhattan Distance: %d\n", manhattan(A, B));

  printf("Euclidian Distance: %f\n", euclidean(A, B));

 

}

Sample output

You might be interested in
Sawing stock to reduce its thickness is known as __________ .
rjkz [21]

Answer:

resawing

Explanation:

8 0
3 years ago
An 800-kg drag racer accelerates from rest to 390 km/hr in 5.8 s. What is the net impulse applied to the racer in the first 5.8
marissa [1.9K]

Answer:

Impulse =14937.9 N

tangential force =14937.9 N

Explanation:

Given that

Mass of car m= 800 kg

initial velocity u=0

Final velocity v=390 km/hr

Final velocity v=108.3 m/s

So change in linear momentum P= m x v

           P= 800 x 108.3

 P=86640 kg.m/s

We know that impulse force F= P/t

So F= 86640/5.8 N

F=14937.9 N

Impulse force F= 14937.9 N

We know that

v=u + at

108.3 = 0 + a x 5.8

a=18.66\ m/s^2

So tangential force F= m x a

F=18.66 x 800

F=14937.9 N

6 0
3 years ago
Write short notes on: (any four) a) Suspended ground floor b) Soil exploration c) Baulking of sand d) Bearing capacity of soil e
vredina [299]

Answer:

a) A suspended floor is a ground floor with a void underneath the structure. The floor can be formed in various ways, using timber joists, precast concrete panels, block and beam system or cast in-situ with reinforced concrete. However, the floor structure is supported by external and internal walls.

b) Soil exploration consists of determining the profile of the natural soil deposits at the site, taking the soil samples and determining the engineering properties of soils using laboratory tests as well as in-situ testing methods

c) Bulking in sand Occurs When dry sand interacts with the atmospheric moisture. Presence of moisture content forms a thin layer around sand particles. This layer generates the force which makes particles to move aside to each other. This results in the increase of the volume of sand.

d) In a nutshell, bearing capacity is the capacity of soil to support the loads that are applied to the ground above. It depends primarily on the type of soil, its shear strength and its density. It also depends on the depth of embedment of the load – the deeper it is founded, the greater the bearing capacity.

Explanation:

<h2>please follow me</h2>
6 0
3 years ago
Anaircraft component is fabricated from an aluminum alloy that has a plane-strain fracture toughness of 40 MPa 1/2.It has been d
navik [9.2K]

Answer:

Yes, fracture will occur since toughness (42.4 MPa) is greater than the toughness of the material, 40MPa

Explanation:

Given

Toughness, k = 40Mpa

Stress, σ = 300Mpa

Length, l = 4mm = 4 * 10^-3m

Under which fracture occurred (i.e., σ= 300 MPa and 2a= 4.0 mm), first we solve for parameter Y (The dimensionless parameter)

Y = k/(σπ√a)

Where a = ½ of the length in metres

Y = 40/(300 * π * √(4/2 * 10^-3))

Y = 1.68 ---- Approximated

To check if fracture will occur of not; we apply the same formula.

Y = k/(σπ√a)

Then we solve for k, where

σ = 260Mpa and a = ½ * 6 * 10^-3

So,.we have

1.68 = k/(260 * π * √(6*10^-3)/2)

k = 1.68 * (260 * π * (6*10^-3)/2)

k = 42.4 MPa --- Approximately

Therefore, fracture will occur since toughness (42.4 MPa) is greater than the toughness of the material, 40 MPa

7 0
3 years ago
Read 2 more answers
Identify an object in your house that contains a physical system and list three questions you could use to define the system
jonny [76]

Answer:

ALL CAREFULLY ANSWERED CORRECTLY

Explanation:

1) A loaf of Bread PHYSICAL SYSTEM

✓ How can the environment affect the edibility of the bread

✓ What are the constituents that makes up the bread

✓ What process is involved in these constituents mixing to form the loaf.

2) The law of thermodynamics makes us to understand that when heat/energy passes through a system, the systems internal energy changes with respect to the conservation of energy law. That is energy lost = energy gained. Typically, ice would melt in a cup of hot tea because of the thermal energy in the molecules of the hot tea. When you heat a material, you are adding thermal kinetic energy to its molecules and usually raising its temperature. The temperature of the ice raises due to the kinetic energy added to it and it melts to water.

3) The theory of systems view the world as a complex system of interconnected parts. If we consider the society; (financial systems, political systems, etc) we will agree that they individually have their own components and it's the summation of this components that makes the system, this implies that system thinking could be applicable in this kinda of systems as long as they are made up of components.

4) Technology has boosted every sector of our lives and it has the capacity to do more. Restricting it's importance to entertainment alone would be an underusing of its potentials. Engineering students infact should not need any drive to be encouraged about maximizing all it can do in shaping our world.

5) ~ Nature shows its splendid soul

~Never ceases to leave us in amazement

~And we are in love

4 0
3 years ago
Other questions:
  • Solve the compound inequality. 3x − 4 &gt; 5 or 1 − 2x ≥ 7
    8·1 answer
  • The soil borrow material to be used to construct a highway embankment has a mass unit weight of 107.0 lb/cf and a water content
    6·1 answer
  • assume a five layer network model. There are 700 bytes of application data. There is a 20 bye header at the transport layer, a 2
    5·1 answer
  • A jet aircraft is in level flight at an altitude of 30,000 ft with an airspeed of 500 ft/s. The aircraft has a gross weight of 1
    11·1 answer
  • Oleg is using a multimeter to test the circuit branch you just installed. After turning off the current to the circuit at the se
    5·1 answer
  • When did michael faraday invent wind powered electrical generation?
    11·1 answer
  • What is the fastest motorcycle in the world ?
    7·2 answers
  • A new approval process is being adapted by Ursa Major Solar. After an opportunity has been approved, the contract is sent to the
    9·1 answer
  • What major problems could you encounter in complex intersections?
    7·1 answer
  • Which type of artificial intelligence (ai) can repeatedly perform tasks of limited scope?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!