summaryrefslogtreecommitdiff
path: root/BlankConsoleLab/BlankConsoleLab.cpp
diff options
context:
space:
mode:
authorMusa Ahmed <[email protected]>2022-10-19 14:59:39 -0700
committerMusa Ahmed <[email protected]>2022-10-19 14:59:39 -0700
commit8502f2dfb8b9f8626b0d4872ff43b44135bd52fd (patch)
tree2a1b2cdd638050446b33614a2fad0d8dbd23bedd /BlankConsoleLab/BlankConsoleLab.cpp
parentLimited input to between 1 and 400 for width & lenght (diff)
downloadcst116-lab1-m005a-8502f2dfb8b9f8626b0d4872ff43b44135bd52fd.tar.xz
cst116-lab1-m005a-8502f2dfb8b9f8626b0d4872ff43b44135bd52fd.zip
renamed
Diffstat (limited to 'BlankConsoleLab/BlankConsoleLab.cpp')
-rw-r--r--BlankConsoleLab/BlankConsoleLab.cpp82
1 files changed, 0 insertions, 82 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp
deleted file mode 100644
index 173f464..0000000
--- a/BlankConsoleLab/BlankConsoleLab.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-// BlankConsoleLab.cpp : This file contains the 'main' function. Program execution begins and ends there.
-//
-
-#include <iostream>
-
-using namespace std;
-
-using std::cout;
-using std::cin;
-using std::endl;
-
-int main()
-{
- float width;
- float length;
- float area;
- float mass;
- float aspect_ratio;
- float grav_pull;
- bool isStable = false;
- bool range = false;
-
-
- while (isStable == false) {
-
- // prompt user for width and length input, then store into appropriate variables
- while (range == false) {
-
- cout << "Enter width (In centimeters): " << endl;
- cin >> width;
- cout << "Enter length (In centimeters): " << endl;
- cin >> length;
- // loops only if the width and length are not between 1 and 400
- if (width > 400 || length > 400 || width < 1 || length < 1) {
- cout << "Please keep the width and length between 1 and 400 centimeters" << endl;
- }
-
- else {
- range = true;
- break;
- }
- }
-
-
- // display the entered values back to the user
- cout << "You entered: " << width << " cm for width, and: " << length << " cm for length" << endl;
-
- // compute and siplay the area
- area = ((width * length) / 2) / 10000;
- cout << "The area for your kite is: " << area << " square meters" << endl;
-
- //computer the aspect ratio and prompt user with warning if condition not met
- aspect_ratio = (width / length);
-
- //compute the mass of the kite by multiplying the area, fabric weight, and converting to kg
- mass = (area * 135) / 1000;
- cout << "The mass of your kite is: " << mass << " kg" << endl;
-
- //compute the gravitional pull of the kite by multiplying th emass by the acceleration due to gravity
- grav_pull = mass * 9.8;
- cout << "The gravitional pull of your kite is: " << grav_pull << " Newtons" << endl;
- //Warns if aspect ratio is too high and causes instability
- if (aspect_ratio >= 1) {
- cout << "Warning, an aspect ratio of: " << aspect_ratio << " is too high and will provide instability" << endl;
- range = false;
-
- }
- // otherwise break out successfully
- else {
- cout << "Aspect Ratio: " << aspect_ratio << endl;
- isStable = true;
- break;
- }
-
-
-
- }
-
-
-
-}
-