summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BlankConsoleLab/CST116-Lab1-Fine.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/BlankConsoleLab/CST116-Lab1-Fine.cpp b/BlankConsoleLab/CST116-Lab1-Fine.cpp
index 4a4431b..5937c04 100644
--- a/BlankConsoleLab/CST116-Lab1-Fine.cpp
+++ b/BlankConsoleLab/CST116-Lab1-Fine.cpp
@@ -6,7 +6,7 @@
using namespace std;
float GetArea(float length, float width);
-
+float getMass(float area);
const int massMeter = 135;
using std::cout;
using std::cin;
@@ -20,6 +20,7 @@ int main()
float area;
float aspectRatio;
int goodRatio = 0;
+ float mass;
while (goodRatio == 0) {
while (correct == 0) {
cout << "Please provide dimensions for your kite between 1 and 400 centimeters." << endl;
@@ -43,7 +44,7 @@ int main()
cout << "Your Kite's area is " << area << " meters squared." << endl;
aspectRatio = (width / length);
if (aspectRatio >= 1) {
- cout << "*Warning* You have a low aspect ratio of " << aspectRatio<< ". A lower aspect ratio would provide better stability for your kite, try haing a smaller width." << endl;
+ cout << "*Warning* You have a low aspect ratio of " << aspectRatio<< ". A lower aspect ratio would provide better stability for your kite, try haing a smaller width." << endl<<endl;
correct = 0;
}
else {
@@ -51,6 +52,8 @@ int main()
cout << "You have a good aspect ratio of " << aspectRatio << endl;
}
}
+ mass = getMass(area);
+ cout << "You kite has a mass of " << mass << "grams." << endl;
}
float GetArea(float length, float width) {
float area = 0;
@@ -58,5 +61,10 @@ float GetArea(float length, float width) {
area = area / 10000;
return area;
}
+float getMass(float area) {
+ float mass = 0;
+ mass = area * massMeter;
+ return mass;
+}