diff options
| author | levidavis04 <[email protected]> | 2022-10-18 15:26:03 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-10-18 15:26:03 -0700 |
| commit | 400c7521c77bbe72e8d90795b79d9b5f16b05664 (patch) | |
| tree | 063cb091d14454843180b3bb688a8d56d152a8d6 | |
| parent | Setting up GitHub Classroom Feedback (diff) | |
| download | cst116-lab1-levidavis04-400c7521c77bbe72e8d90795b79d9b5f16b05664.tar.xz cst116-lab1-levidavis04-400c7521c77bbe72e8d90795b79d9b5f16b05664.zip | |
| -rw-r--r-- | Lab1-PSEUDOCODE-Davis.rtf | 37 | ||||
| -rw-r--r-- | main.cpp | 54 |
2 files changed, 91 insertions, 0 deletions
diff --git a/Lab1-PSEUDOCODE-Davis.rtf b/Lab1-PSEUDOCODE-Davis.rtf new file mode 100644 index 0000000..507efb7 --- /dev/null +++ b/Lab1-PSEUDOCODE-Davis.rtf @@ -0,0 +1,37 @@ +{\rtf1\ansi\ansicpg1252\cocoartf2639 +\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +{\*\expandedcolortbl;;} +\margl1440\margr1440\vieww11520\viewh8400\viewkind0 +\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 + +\f0\fs24 \cf0 Pseudo Code\ +\ +Variables = 0\ +\ +Print \'93What is your kites width?\ +User input = width\ + if (width > 400 or width < 1)\ + Print \'93Please enter a different width\'94\ + while (width > 400 or width < 1)\ +Print \'93What is your kites length?\'94\ +User input = length\ + if (length > 400 or length < 1)\ + Print \'93Please enter a different length\'94\ + while (length > 400 or length < 1)\ +\ +Area = ((length * width) / 2) / 1000\ +Print \'93The area of your kite is \'93 +area\ +\ +Aspectratio = width / length\ +Print \'93Your aspect ratio is \'93 +aspectratio\ +If (aspect ratio >= 1)\ + print \'93Your kite is not very stable, a lower aspect ratio would make it more stable\'94\ +Else if (aspect ratio < 1)\ + Print \'93Your kite is stable! Congrats\'94\ +Mass = ((length * width) * 135) / 1000)\ +Print \'93In kg your kite weighs \'93 +mass\ +\ +Gravitationalpull = mass * 9.8\ +Print \'93The gravitational pull of your kite is \'93 +gravitationalpull \'93N/kg\'94\ +Return variables to 0}
\ No newline at end of file diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..c0d3a6b --- /dev/null +++ b/main.cpp @@ -0,0 +1,54 @@ +// +// main.cpp +// CST116-Lab1 Kite Demtion Project LeviDavis +// +// Created by Levi on 10/13/22. +// + +#include <iostream> + +int width = 0; +int length = 0; +float area = 0; +float aspectratio = 0; +float mass = 0; +float gravitationalpull = 0; + +using namespace std; + +using std::cout; +using std::cin; +using std::endl; + +int main() +{ + do { + cout << "What is your kite's width in cenemeters? Please enter a width between 1-400 cm" << endl; + cin >> width; + if (width > 400 || width < 1) + cout << "Please enter a different width" <<endl; + } while (width > 400 || width < 1); + do { + cout << "Now what is the length of your kite in cenemeters? Please enter a length between 1-400 cm" <<endl; + cin >> length; + if (length > 400 || length > 1) + cout << "Please enter a different length"<<endl; + } while (length > 400 || length < 1); + + cout << "The width of your kite is " <<width<<" and the length is " <<length<<endl; + area = (length * width) / 2; + area = area / 1000; + cout << "The area of your kite in sq meters is " <<area<<endl; + aspectratio = width / length; + cout << "Your aspect ratio is " <<aspectratio<<endl; + if(aspectratio >= 1) + cout << "Your kite is not very stable, a lower aspect ratio would make it more stable"<<endl; + else if(aspectratio < 1) + cout << "Your kite is stable! Congrats"<<endl; + mass = ((length * width) * 135) / 1000; + cout << "In kg your kite weighs " <<mass<<endl; + + gravitationalpull = mass * 9.8; + cout <<"The gravitational pull of your kite is "<<gravitationalpull<<"N/kg"<<endl; + return 0; +} |