From 168730939c17d7455aa22aa1c4ab045e88e809a5 Mon Sep 17 00:00:00 2001 From: prestonderek Date: Tue, 18 Oct 2022 13:44:17 -0700 Subject: Commit for part 1 complete --- BlankConsoleLab/BlankConsoleLab.cpp | 27 ++++++++++-- BlankConsoleLab/BlankConsoleLab.vcxproj | 11 +++-- BlankConsoleLab/BlankConsoleLab.vcxproj.filters | 3 ++ BlankConsoleLab/CST116-Lab1-Pseudocode-Preston.txt | 50 ++++++++++++++++++++++ 4 files changed, 84 insertions(+), 7 deletions(-) create mode 100644 BlankConsoleLab/CST116-Lab1-Pseudocode-Preston.txt diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp index ed5f807..e80106c 100644 --- a/BlankConsoleLab/BlankConsoleLab.cpp +++ b/BlankConsoleLab/BlankConsoleLab.cpp @@ -3,14 +3,35 @@ #include -using namespace std; - using std::cout; using std::cin; using std::endl; int main() { - cout << "Hello World!\n"; + int width; + int length; + float areaCM; + float areaM; + float ratio; + + cout << "Please enter the length of your kite." << endl; + cin >> length; + + cout << "\nPlease enter the width of your kite." << endl; + cin >> width; + cout << "\n"; + + areaCM = (width * length) / 2; + areaM = areaCM / 10000; + ratio = width / length; + + if (ratio >= 1) + { + cout << "WARNING: A lower aspect ratio \nwill provide more stability!\n" << endl; + } + + cout << "Your kite has an area of: " << areaM << " square meters" << endl; + cout << "Your kite has an area of: " << areaCM << " square centimeters" << endl; } diff --git a/BlankConsoleLab/BlankConsoleLab.vcxproj b/BlankConsoleLab/BlankConsoleLab.vcxproj index db2e734..579a879 100644 --- a/BlankConsoleLab/BlankConsoleLab.vcxproj +++ b/BlankConsoleLab/BlankConsoleLab.vcxproj @@ -29,26 +29,26 @@ Application true - v142 + v143 Unicode Application false - v142 + v143 true Unicode Application true - v142 + v143 Unicode Application false - v142 + v143 true Unicode @@ -141,6 +141,9 @@ + + + diff --git a/BlankConsoleLab/BlankConsoleLab.vcxproj.filters b/BlankConsoleLab/BlankConsoleLab.vcxproj.filters index aca1dd9..18518c8 100644 --- a/BlankConsoleLab/BlankConsoleLab.vcxproj.filters +++ b/BlankConsoleLab/BlankConsoleLab.vcxproj.filters @@ -19,4 +19,7 @@ Source Files + + + \ No newline at end of file diff --git a/BlankConsoleLab/CST116-Lab1-Pseudocode-Preston.txt b/BlankConsoleLab/CST116-Lab1-Pseudocode-Preston.txt new file mode 100644 index 0000000..c6ab8c4 --- /dev/null +++ b/BlankConsoleLab/CST116-Lab1-Pseudocode-Preston.txt @@ -0,0 +1,50 @@ +Agile notes and Pseudocode for Lab1 + +This program requires the following + +2 inputs: + length of the kite in meters + width of the kite in meters + +Notes: + Ask the user for width and length in cm + Print what the user entered for width and length + Computer the area of the kite using Area=(width x length)/2 + Convert the square cm to square m by dividing by 10000 + Print area in sq m, this uses decimals + computer the aspect ratio of the kite. Aspect ratio is width/length + If the aspect ratio is greater than 1 print a warning to user that a lower ratio would provide more stability. + +Output: + Output is self documenting + Shows input with labels, then the output + + +Pseudocode for part 1: + +int width +int length +float areaCM +float areaM +int ratio + +begin main function + print "enter width of kite" + input width + print "enter length of kite" + input length + print "your kite has a width of: " width " and length of: " length + + areaCM = width x length / 2 + areaM = areaCM / 10000 + ratio = width / length + + if ratio >= 1 + "Warning, a lower aspect ratio would provide more stability" + else + "nice aspect ratio" + + print "your kite's area in square meters is: " areaM + + + \ No newline at end of file -- cgit v1.2.3