From 89ed3927e688e40510ccfe541995ece5a5a2a180 Mon Sep 17 00:00:00 2001 From: KOSASIH Date: Tue, 30 Jul 2024 08:26:02 +0700 Subject: [PATCH] Create propulsion_system.cpp --- core/aerospace/propulsion_system.cpp | 33 ++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 core/aerospace/propulsion_system.cpp diff --git a/core/aerospace/propulsion_system.cpp b/core/aerospace/propulsion_system.cpp new file mode 100644 index 0000000..56fdac5 --- /dev/null +++ b/core/aerospace/propulsion_system.cpp @@ -0,0 +1,33 @@ +#include +#include + +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; +}