summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BlankConsoleLab/BlankConsoleLab.cpp37
-rw-r--r--LabResults.txt36
2 files changed, 63 insertions, 10 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp
index 5cb2039..bf375fb 100644
--- a/BlankConsoleLab/BlankConsoleLab.cpp
+++ b/BlankConsoleLab/BlankConsoleLab.cpp
@@ -10,24 +10,39 @@
using namespace std;
+const float kite_weight = 135;
int main()
{
float width = 0, length = 0;
- cout << "Please input your kites width in centimeters: ";
- cin >> width;
-
- cout << endl;
+ while (width < 1 || width > 400)
+ {
+ cout << "Please input your kites width in centimeters: ";
+ cin >> width;
+ cout << endl;
+ if (width < 1 || width > 400)
+ {
+ cout << "Width cannot be greater than 400 or less than 1." << endl;
+ }
+
+ }
- cout << "Please input your kites height in centimeters: ";
- cin >> length;
- cout << endl;
+ while (length < 1 || length > 400)
+ {
+ cout << "Please input your kites length in centimeters: ";
+ cin >> length;
+ cout << endl;
+ if (length < 1 || length > 400)
+ {
+ cout << "Length cannot be greater than 400 or less than 1." << endl;
+ }
+ }
- cout << "Your kites width will be: " << width << " cm\nYour kites height will be: " << length << " cm" << endl;
+ cout << "Your kites width will be: " << width << " cm\nYour kites length will be: " << length << " cm" << endl;
- float area = (width / length) / 10000;
+ float area = ((width * length)/2) / 10000;
cout << "The area of your kite in square meters is " << area << endl;
@@ -37,7 +52,11 @@ int main()
cout << "Your aspect ration is greater than 1 (width/length: " << width << "/" << length << " = " << aspect_ratio << ")\nLower aspect ratios will have greater stability." << endl;
}
+ float mass = (area * kite_weight) / 10000;
+ cout << "Your kites mass is: " << mass << "kg." << endl;
+ float gravitational_pull = mass * 9.8;
+ cout << "The kites gravitational pull is: " << gravitational_pull << "N/kg." << endl;
}
diff --git a/LabResults.txt b/LabResults.txt
index bfe34d2..5c2b583 100644
--- a/LabResults.txt
+++ b/LabResults.txt
@@ -1 +1,35 @@
-RunResults \ No newline at end of file
+RunResults
+
+
+Please input your kites width in centimeters: 10
+
+Please input your kites height in centimeters: 10
+
+Your kites width will be: 10 cm
+Your kites height will be: 10 cm
+The area of your kite in square meters is 0.005
+Your kites mass is: 6.75e-05kg.
+The kites gravitational pull is: 0.0006615N/kg.
+
+C:\Users\wythe\Desktop\Homework\C++\lab1\x64\Debug\BlankConsoleLab.exe (process 26276) exited with code 0.
+To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
+Press any key to close this window . . .
+
+
+
+
+Please input your kites width in centimeters: 100
+
+Please input your kites length in centimeters: 5
+
+Your kites width will be: 100 cm
+Your kites length will be: 5 cm
+The area of your kite in square meters is 0.025
+Your aspect ration is greater than 1 (width/length: 100/5 = 20)
+Lower aspect ratios will have greater stability.
+Your kites mass is: 0.0003375kg.
+The kites gravitational pull is: 0.0033075N/kg.
+
+C:\Users\wythe\Desktop\Homework\C++\lab1\x64\Debug\BlankConsoleLab.exe (process 32800) exited with code 0.
+To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
+Press any key to close this window . . . \ No newline at end of file