diff options
| author | Joe Traver <[email protected]> | 2022-10-19 00:04:36 -0700 |
|---|---|---|
| committer | Joe Traver <[email protected]> | 2022-10-19 00:04:36 -0700 |
| commit | 4814b59e32a95bf99702569fc11a963472a16abe (patch) | |
| tree | 7f947c3c17a1ddaf3d302183bc746edbef6b9dab | |
| parent | Added do while loop to set input perameters (diff) | |
| download | cst116-lab1-joetraver30-4814b59e32a95bf99702569fc11a963472a16abe.tar.xz cst116-lab1-joetraver30-4814b59e32a95bf99702569fc11a963472a16abe.zip | |
Added the mass calculation and the formulas for gravitational pull
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.cpp | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp index 0705133..3fb3426 100644 --- a/BlankConsoleLab/BlankConsoleLab.cpp +++ b/BlankConsoleLab/BlankConsoleLab.cpp @@ -13,9 +13,14 @@ int main() { int length; float width; - float area; - float meters; + float area_cm; + float area_m; float ratio; + int grav = 9.81; + float mass; + int weight = 135; + int grav_pull; + int masskg; do @@ -35,12 +40,12 @@ int main() // area calculation - area = (length * width) / 2; + area_cm = (length * width) / 2; // unit conversion - meters = area / 10000; + area_m = area_cm / 10000; - cout << "Kite area: " << meters << " square meters" << endl; + cout << "Kite area: " << area_m << " square meters" << endl; // aspect ratio ratio = width / length; @@ -50,6 +55,20 @@ int main() cout << "WARNING! A lower aspect ratio would provide more stability" << endl; + + + // mass calculation + mass = (area_m * weight) / grav; + + cout << "Total mass of the kite is: " << mass << " Grams" << endl; + + //force applied to the kite converted to Newtons + + masskg = mass / 1000; + grav_pull = mass * grav; + + cout << "Gravitational pull applied to the kite is: " << grav_pull << " Newtons" << endl; + return 0; } |