I am confused

KaitlynHowell (6)
Can someone explain me what do I have to do step by step?

PROBLEM
-------
A physics professor asked one of his students, "How could
we determine the height of a building using a barometer?" The
student replied, "I could tie a string to the barometer and lower
it to the ground from the top. Then I could measure the string."
The physics professor chuckled and said, "I want a more physics
based solution." The student then said "Ok, I could drop the
barometer from the top of the building and then time its decent and
then calculate the height using the formula d=(1/2)*g*t^2. That's
brilliant!" Much to the professor's horror, before he could
correct his student the boy snatched the professor's prized
barometer and raced to the stairs.

Now, we know the professor is going to lose his barometer, so the
least we can do is to help him make the most of it. We are going
to design and implement a program which will measure the height of
the building in terms of barometric catastrophe. A sample run of
this program might be:

---- begin sample run ----
Drop your barometer.
How long was it until you heard a crashing sound (in seconds)? 2.5

Your building is 30.65 meters tall.

Now, you do realize that barometers are filled with mercury,
right? Call the EPA NOW!
---- end sample run ----

Procedure
---------
1. Write out your pseudocode for how you are going to implement
this program. Your pseuedocode should include a listing of the
program's inputs, outputs, and the steps it performs. Also,
during this part of the program, you'll want to identify the
proper variable types for your inputs and outputs.

2. Set out a series of test cases (at least 5). Test cases should
include a series of example inputs and the expected
outputs. (see hints for how to do the math)

3. Using your favorite text editor, type out your pseudocode and
test cases into a text file named "lab2-2-test". Submit this
file using the turnin program:

~relowe/turnin lab2-2-test

By the end of class on Wednesday 1/30/2013

4. Write your program in c++. Compile it, test it. Once it all
works create a typescript file named "lab2-2-run" which contains
the following:

- A listing of your source code. (hint: use cat)
- Running your compile command so I can see your code compiles
without errors or warnings.
- Sample runs of your program for each of your test cases.

Be sure to type exit after you have generated all your output.
Turnin your script file using:

~relowe/turnin lab2-2-test

HINTS
-----
- We want to make the program give output in meters. Therefore, our
gravitational acceleration constant is g = 9.81 m/s^2. I would
recommend creating a constant for g.

- C does not have an exponent operator, therefore t^2 should be
written as t*t.

- The above example was computed as follows (in algebra, not C++):

d = (1/2) * 9.81 * 2.5^2
= (1/2) * 9.81 * 6.25
= 30.65625


END NOTE: This document was completely typed using emacs. It is a
plain text document, and so it should be readable on every
computational device known to man!
Disch (8617)
Looks like it already tells you what to do step by step. See the whole section labelled "Procedure". Is there a step there that is giving you a particular amount of trouble?

EDIT:

btw... a teacher that encourages planning out the idea in pseudo-code, creating a few test cases... as well as making the problem itself comically interesting?

This teacher is great. I've seen a lot of lame homework assignments given by teachers who don't know what they're doing. This is not one of those times. This teacher is awesome.
Last edited on
cnoeval (462)
Agreed Disch, except for the END NOTE. I couldn't get that doc to display on my Bomar Brain OR my abacus.
Registered users can post here. Sign in or register to post.