1 / 2

Exercise 1

Track #1. Track #2. D. X. G. Exercise 1. When two railway tracks cross each other “at grade” (at the same level), a piece of track work called a “diamond” is used. The diagram below should give the idea.

Download Presentation

Exercise 1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Track #1 Track #2 D X G Exercise 1 When two railway tracks cross each other “at grade” (at the same level), a piece of track work called a “diamond” is used. The diagram below should give the idea. Note that, in both directions, there are gaps in the rails When a train goes over a diamond, its wheels drop into these gaps, as shown below. The amount that the wheels drop (X on the diagram) depends on both the diameter of the wheels (D) and the size of the gap (G).

  2. You are to write, test, and submit a C++ program which, after reading in values for “D” and “G”, calculates and outputs the value of “X”. “D”, “G”, and “X” are all to be in inches. The “hard” part of this assignment is coming up with a formula for “X” (strong hint: consider the triangle shown in dotted lines). The actual program is as about basic as they get (no if’s and no loops). Square roots may be computed by using function “sqrt” (as illustrated by the code snippet below). Note that, in order to use this function, you must put “#include <math.h>” at the start of your program. #include <math.h> …. double x, y; …. x = sqrt(y); // the square root of the valuie stored in “y” is placed into “x” Values can be squared using a function called “pow”, but it makes more sense to just multiply a value by itself. There is no “sqr” function. If you find this assignment a bit boring (as many of you doubtless will), try writing a program which output a table giving the values of “X” for a range of possible wheel sizes. If you wish, you may submit this in place of the standard program. Wheel Diameter Drop --------------------------------------- 30 … 31 … etc. Some background: The “O” train passes over two diamonds in between the Confederation and Greenboro stations, and must slow down in both cases. The speed restrictions were imposed because the central two trucks of “O” trains have smaller than standard wheels. These drop more than usual when crossing over diamonds, and Bombardier (the manufacturer) is concerned about possible damage.

More Related