summaryrefslogtreecommitdiff
path: root/BlankConsoleLab/CST116-Lab1-Fine.cpp
diff options
context:
space:
mode:
authorEdwardFine <[email protected]>2022-10-18 17:07:41 -0700
committerEdwardFine <[email protected]>2022-10-18 17:07:41 -0700
commitcfd88d06ec80e1d82c88e44370f72c3f4f812dd5 (patch)
tree74e6b5077a3ca0261090171cba9b6cbc9b2ed3b1 /BlankConsoleLab/CST116-Lab1-Fine.cpp
parentConst for mass/square meter (diff)
downloadcst116-lab1-edwardfine-cfd88d06ec80e1d82c88e44370f72c3f4f812dd5.tar.xz
cst116-lab1-edwardfine-cfd88d06ec80e1d82c88e44370f72c3f4f812dd5.zip
Compute mass
Diffstat (limited to 'BlankConsoleLab/CST116-Lab1-Fine.cpp')
-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;
+}