So here is my application for class, it is not due for a while, but I got started on it. It compiles without error it just takes the input and makes the first test output. The cout text output is just there for testing purposes, it should be replaced later with the graphical aspect of the data output.

Although the instructions are talking about making graphics to represent it, I want to get what is "under the hood" working first, then work on the graphic output.

Instructions:

Idea:

Plane is moving at a speed set by user input (in feet per second).

Application simulates a person jumping out. Falling at a rate of 32ft/sec.

The freefall time (in seconds) is inputted by the user, as well as the height of the plane (in feet).

Constants:

Deceleration factor - the rate at which the parachutist will decelerate in the vertical direction after the chute opens. It is typically very high - 100 ft/secsec. Until the chute opens, the parachutist's velocity increases by 32 ft/secsec. However, terminal velocity is reached at 174/ft/sec.

Drag Factor - This is the rate at which the parachutist will decelerate in the horizontal direction after the chute opens. It is typically 20-60 ft/secsec. Until the chute opens, we assume the chutist is moving at the speed of the airplane.

User inputted data:

speed of the plane (feet per second)

height of the plane (feet)

freefall time (seconds)

The simulation works by calculating the position of the parachutist each second between the time of the jump and landing on the ground. When the chutist jumps, the velocity increases (up to terminal) until the chute opens. You need to calculate the chutist' speed as well as horizontal and vertical position. When the chute opens, both the horizontal and vertical speeds decreases until the vertical speed is 17 ft/sec and the horizontal feed is 0 ft/sec.

The program should plot the descent of the parachutist using our simple graphics package. You can use a simple circle to represent the chutist. A single while loop is sufficient to handle the simulation. It would look something like this :

* each loop calculates the chutist's speed and position each second

* update chutist's speed

* update chutist's position

* indicate when the chute has opened - e.g. horizontal line.

* plot the chutist (every 3 or 4 seconds)

When the parachutist has landed, print out the chutist's landing velocity. This will indicate the success (or other) of the simulation.

EXTRA: Design a parachuteman using the graphics system and have him fall.

HERE IS MY CODE: Sorry if it is noobish, but I want to get better.

#include <iostream> #include <cmath> using namespace std; int dropspeed = 0; int planespeed = 0; int freefalltime; int time2; int height; int time=0; int main() { cout << "Please enter the plane speed: " << endl; cin >> planespeed; cout << "Enter plane height: " << endl; cin >> height; cout << "Enter freefall time: " << endl; cin >> freefalltime; while (height >= 0) { while (time <= freefalltime) { while (dropspeed <= 174) { time2 = time; dropspeed = dropspeed + 32; height = height - dropspeed; dropspeed = 174; if (time%3==0 || time==0) { cout << "Plotting height = " << height << " || dropspeed = " << dropspeed << endl; time++; } } } for (int time3 = time2;;) { while (dropspeed >= 17) { dropspeed = dropspeed - 100; planespeed = planespeed - 20; } dropspeed = 17; height = height - dropspeed; time = time3; if (time % 3 == 0 || time==0) { cout << "Plotting height = " << height << " || dropspeed = " << dropspeed << endl; time3++; } } } }

I am kind of stuck here. It compiles but stops after the first output. I am sure I will figure it out, however I would appreciate if someone with much more experience than myself could give their input on what areas I should be studying and what I am doing wrong.

This post has been edited by **senseiz**: 14 January 2010 - 01:26 AM