diff options
Diffstat (limited to 'BlankConsoleLab/BlankConsoleLab.cpp')
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp index e381995..62450bb 100644 --- a/BlankConsoleLab/BlankConsoleLab.cpp +++ b/BlankConsoleLab/BlankConsoleLab.cpp @@ -14,12 +14,14 @@ using std::endl; float kiteCalc(float wid, float len); float aspectCalc(float wid, float len); +float massCalc(float areaVal); int main() { float kiteWidth = 0; float kiteLen = 0; float kiteArea = 0; + float kiteMass = 0; // get user input for kiteWidth. Value entered must be between 1 and 400 or it will loop and ask again. while(kiteWidth < 1 || kiteWidth > 400) @@ -35,7 +37,6 @@ int main() cin >> kiteLen; } - cout << "\nYou have entered " << kiteWidth << "cm for kite width, and " << kiteLen << "cm for kite length." << endl; //calculate the area of the kite and store in kiteArea @@ -44,6 +45,8 @@ int main() //calculate the aspect ratio of the kite and spit out a message to the user if the aspect ratio is greater than or equal to 1 aspectCalc(kiteWidth, kiteLen); + + kiteMass = massCalc(kiteArea); } float kiteCalc(float wid, float len) @@ -75,3 +78,14 @@ float aspectCalc(float wid, float len) } } + +float massCalc(float areaVal) +{ + cout << "Calculating kite mass....\n"; + + // calculate the mass of the kite/square meter assuming fabric mass of 135 Grams/Square meter + float kiteAreaCalc = 135 / areaVal; + + cout << "Kite mass: " << kiteAreaCalc << endl; + return kiteAreaCalc; +}
\ No newline at end of file |