// File: Genesis.cxx // This program simulates a falling object with a rocket. #include using namespace std; const double LATERAL_PROP = 0.1; // Proportion const double GRAVITY = -9.8; // m/s^2 const double LANDER_WEIGHT = 1000; // kg const double MAX_FUEL = 0.25*LANDER_WEIGHT; // kg const double THRUST_Y = -2*GRAVITY*(LANDER_WEIGHT + MAX_FUEL);// kg m/s^2 const double THRUST_X = THRUST_Y * LATERAL_PROP; // kg m/s^2 const double INITIAL_MAX_X = 500; // m const double INITIAL_Y = 1000; // m const double INITIAL_SPEED_X = 0; // m/s const double INITIAL_SPEED_Y = 0; // m/s const double BURN_RATE_Y = MAX_FUEL / 30; // kg/s const double BURN_RATE_X = BURN_RATE_Y * LATERAL_PROP; // kg/s const double MAX_LANDING_SPEED = 9.0; // m/s // The display function shows the current state of the lander. void display( double time, // Simulation time double x, double y, // Position double vx, double vy, // Velocity double fuel, // Remaining fuel bool main_thruster, // Thrusters on? bool left_thruster, bool right_thruster ); int main( ) { } void display( double time, // Simulation time double x, double y, // Position double vx, double vy, // Velocity double fuel, // Remaining fuel bool main_thruster, // Thrusters on? bool left_thruster, bool right_thruster ) { cout << "Lander information: \n" << "Time: " << time << "s\n" << "Position (x: " << x << "m, y: " << y << "m)\n" << "Velocity (x: " << vx << "m/s, y: " << vy << "m/s)\n" << "Remaining fuel: " << fuel << "kg\n" << "Thrusters: (" << "main:" << main_thruster << ", left:" << left_thruster << ", right:" << right_thruster << ")\n" << endl; }