From 8514566f17bde07d7a7753cb59256f13aa687845 Mon Sep 17 00:00:00 2001 From: EdwardFine Date: Wed, 19 Oct 2022 09:43:37 -0700 Subject: Calculate Gravitational pull and display it in console --- BlankConsoleLab/BlankConsoleLab.vcxproj | 1 + BlankConsoleLab/CST116-Lab1-Fine.cpp | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/BlankConsoleLab/BlankConsoleLab.vcxproj b/BlankConsoleLab/BlankConsoleLab.vcxproj index 649a51e..c58d92a 100644 --- a/BlankConsoleLab/BlankConsoleLab.vcxproj +++ b/BlankConsoleLab/BlankConsoleLab.vcxproj @@ -24,6 +24,7 @@ {3cecade6-3e15-4852-bd24-65bfe5d3a3aa} BlankConsoleLab 10.0 + Cst116-Lab1-EdwardFine diff --git a/BlankConsoleLab/CST116-Lab1-Fine.cpp b/BlankConsoleLab/CST116-Lab1-Fine.cpp index 5937c04..e437a83 100644 --- a/BlankConsoleLab/CST116-Lab1-Fine.cpp +++ b/BlankConsoleLab/CST116-Lab1-Fine.cpp @@ -2,12 +2,17 @@ // #include +#include using namespace std; +using std::pow; float GetArea(float length, float width); float getMass(float area); +float getGrav(float mass); const int massMeter = 135; +const int gravConst = 6674300; +const int earthMass = 59720000; using std::cout; using std::cin; using std::endl; @@ -21,6 +26,7 @@ int main() float aspectRatio; int goodRatio = 0; float mass; + float gravPull; while (goodRatio == 0) { while (correct == 0) { cout << "Please provide dimensions for your kite between 1 and 400 centimeters." << endl; @@ -53,7 +59,9 @@ int main() } } mass = getMass(area); - cout << "You kite has a mass of " << mass << "grams." << endl; + cout << "You kite has a mass of " << mass << " kilograms." << endl; + gravPull = getGrav(mass); + cout << "Your kite has a gravitational pull to the Earth of " << gravPull << "N at 200 m in the sky." <