Skip to content

Commit

Permalink
Create propulsion_system.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Jul 30, 2024
1 parent 1208704 commit 89ed392
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions core/aerospace/propulsion_system.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <iostream>
#include <cmath>

class PropulsionSystem {
public:
PropulsionSystem(double thrust, double specific_impulse) {
this->thrust = thrust;
this->specific_impulse = specific_impulse;
}

double calculate_acceleration(double mass) {
return this->thrust / mass;
}

double calculate_delta_v(double mass, double time) {
return this->thrust / mass * time;
}

private:
double thrust;
double specific_impulse;
};

int main() {
PropulsionSystem propulsion_system(100, 300);
double mass = 1000;
double time = 10;
double acceleration = propulsion_system.calculate_acceleration(mass);
double delta_v = propulsion_system.calculate_delta_v(mass, time);
std::cout << "Acceleration: " << acceleration << " m/s^2" << std::endl;
std::cout << "Delta-v: " << delta_v << " m/s" << std::endl;
return 0;
}

0 comments on commit 89ed392

Please sign in to comment.