In this homework assignment you are going to write a program

In this homework assignment, you are going to write a program to simulate the flight of a parachutist using difference parachute parameters and under different test parameters. You will design a parachutist using the graphics system and have him fall The first part of the project will have you crea a class Parachutist which has a constructor, mutator, and accessor function. The constructor will create the parachutist at a point passed a a parameter. The mutator function will move the parachutist by the parameters dx dy. The accessor function will plot (output) the parachutist to the screen. Your main program will set the parameters of the parachute using constant declarations. Acceleration Factor This is the rate at which the parachutist will increase in the vertical direction before the chute opens. This is 32 ft/sec/sec. (i.e., Every second the verical velocity increases by 32 ft/sec.) Terminal Velocity 174 ft/sec. Vertical velocity cannot exceed this Deceleration Factor This is the rate at which the parachutist will decelerate in the vertical direction after the chute opens. It is typically very high 100 ft/secsec. The vertical velocity decreases by 100 ft/sec until it reaches 17 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 assume the chutist is moving at the speed of the airplane. The horizontal velocity then decreases each second by the drag factor until it reaches 0 The program will input 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 begin by using 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) After you have the program working with a circle, you can then replace the circle with an object from your parachute class. When the parachutist has landed, print out the chutist\'s landing velocity. This will indicate the success (or other) of the simulation.

Solution

#include \"ccc_win.h\" using namespace std; class Parachutist { public: Parachutist(); //constructors Parachutist(Point loc); void move(double pull, double speed); //mutator private: double changey;// = 0; //deceleration factor //change in y each second, due to gravity and parachute double changex;// = 0; //drag factor //change in x each second, due to drag double speed; double sec; double r; double x; double y; Point llc; void noParachute() const; //accessors void yesParachute() const; }; Parachutist::Parachutist() { llc = Point(0,0); } Parachutist::Parachutist(Point loc) { llc=loc; } void Parachutist:: move(double pull, double speed) { while (llc.get_y()>=120) //it is so high because the scale of the person had to be large to look decent on the display. I wanted his feet to touch the ground, not his head which the point is based off of. { if(sec 174) {changey = 174;} //doesn\'t go over terminal velocity llc.move(changex,-changey); //change y\'s position //change x\'s position } else if(sec >= pull) { sec++; yesParachute(); changey = changey-(100 * sec); changex = changex-20; if(changex <= 0) {changex = 0;} //don\'t want them going backwards if(changey <= 17) {changey = 17;} //Slowest parachute will slow them down. llc.move(changex,-changey); //change y\'s position //change x\'s position } } } void Parachutist::noParachute() const{ double r=20; double x=llc.get_x(); double y=llc.get_y(); //head Point h1(x+0,y+0); //body Point b1(x+0,y-r); Point b2(x+0,y-(4*r)); //legs Point l1(x+((0.5)*r),y-(6*r)); Point l2(x-((0.5)*r),y-(6*r)); //arms Point c1(x+0,y-(2.0*r)); Point a1(x+(r),y-(1.5*r)); Point a2(x-(r),y-(1.5*r)); //connect the dots cwin << Circle(h1,r) << Line(b1,b2) << Line(b2,l1) << Line(b2,l2) << Line (c1,a1) << Line (c1,a2); } void Parachutist::yesParachute() const{ double r=20; double x=llc.get_x(); double y=llc.get_y(); //head Point h1(x+0,y+0); //body Point b1(x+0,y-r); Point b2(x+0,y-(4*r)); //legs Point l1(x+(0.5*r),y-(6*r)); Point l2(x-(0.5*r),y-(6*r)); //arms Point c1(x+0,y-(3*r)); Point a1(x+(r),y-(1.5*r)); Point a2(x-(r),y-(1.5*r)); //parachute Point c2(x+0,y-(2*r)); Point s1(x-(3*r),y+(3*r)); Point s2(x+(3*r),y+(3*r)); Point s3(x+0,y+(3*r)); Point p3(x+(2*r),y+(4*r)); Point p2(x+0,y+(5*r)); Point p1(x-(2*r),y+(4*r)); //connect the dots cwin << Circle(h1,r) << Line(b1,b2) << Line(b2,l1) << Line(b2,l2) << Line (c1,a1) << Line (c1,a2) << Line(c2,s1) << Line (c2,s2) << Line(s1,s2) << Line(s1,p1) << Line(s2,p3) <
 In this homework assignment, you are going to write a program to simulate the flight of a parachutist using difference parachute parameters and under different

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site