Introduction to C  Programming Assignment #3
Due date: Please consult WebCourses for your section
Objectives
1.
To learn how to use loops to solve problems.
2.
To learn how to read information from files to help speed program testing.
Problem A: Roller Coaster Height Restriction (height.c)
All roller coasters have height restrictions. In designing a coaster, the founders of UCF
want to hire you to do some background work. In particular, they would like you to
produce a chart that shows the height restriction for various different heights of the
coaster.
In particular, the height of the coaster can be used to calculate the maximum velocity of
the coaster. The following set of equations can be used to aid the calculation:
=( .
)
h
4 9ms2 t2
, where h represents the height of the coaster and t represents the amount
of time to fall from the top of the coaster to the bottom.
= .
v 9 8ms2t
, where v represents the maximum velocity of the coaster for the specific
value of t designated by the first equation.
Note that for these equations, we want height to be measured in meters, velocity to be
measured in meters/sec and time to be measured in seconds.
For a given maximum velocity (measured in meters/second), to calculate the minimum
height of the rider in inches, we must take this maximum velocity, take its square root
and multiply by twelve:
=
MinHeightinches 9v
, where v is the same as defined the previous equation.
For this program, ask the user for a minimum possible height of a roller coaster and a
maximum possible height, in meters, and output for each meter in between, the minimum
height (in inches) for a rider of that coaster.
Input Specification
1. Both the minimum and maximum possible heights of the coaster will be positive
integers in between 5 and 100 (meters), inclusive. The minimum is guaranteed to be less
than or equal to the maximum.
Output Specification
The output should consist of a chart with the following column headers:
Coaster Height(meters)
Minimum Height(inches)
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document

The following
lines should have one line per coaster height (thus there should be high –
low + 1 of these lines, where low and high are the bounds entered by the user for the
minimum and maximum possible coaster height.) The coaster height should be printed as
an integer and the minimum height to ride the coaster should be printed as a real number
rounded to 2 decimal places.
Output Samples
Two sample outputs of running the program are included below.
Note that these
samples are NOT a comprehensive test.
You should test your program with different
data than is shown here based on the specifications given above.
Sample Run #1
What is the minimum coaster height?
10
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '08
 Guha
 coaster height

Click to edit the document details