aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan HarrisToovy <[email protected]>2021-10-18 01:07:43 -0700
committerJordan HarrisToovy <[email protected]>2021-10-18 01:07:43 -0700
commit3245f72ea310b3ea0f1035f60e86f41d8f0371e7 (patch)
tree08a20ef965b0682d06be724d811052660e0cec99
parentAdd online IDE url (diff)
downloadcst116-lab3-jordanht-oit-3245f72ea310b3ea0f1035f60e86f41d8f0371e7.tar.xz
cst116-lab3-jordanht-oit-3245f72ea310b3ea0f1035f60e86f41d8f0371e7.zip
Temporary push for backup
-rw-r--r--CST116 Lab3 Harris-Toovy.sln (renamed from CST116F2021-Lab3.sln)2
-rw-r--r--CST116F2021-Lab3/CST116 Lab3 Harris-Toovy.cpp326
-rw-r--r--CST116F2021-Lab3/CST116 Lab3 Harris-Toovy.filters (renamed from CST116F2021-Lab3/CST116F2021-Lab3.vcxproj.filters)0
-rw-r--r--CST116F2021-Lab3/CST116 Lab3 Harris-Toovy.vcxproj (renamed from CST116F2021-Lab3/CST116F2021-Lab3.vcxproj)2
-rw-r--r--CST116F2021-Lab3/CST116 Lab3 Textual Work Harris-Toovy.txt27
-rw-r--r--CST116F2021-Lab3/CST116F2021-Lab3.cpp20
-rw-r--r--CppProperties.json21
7 files changed, 376 insertions, 22 deletions
diff --git a/CST116F2021-Lab3.sln b/CST116 Lab3 Harris-Toovy.sln
index 346b5fd..75668ad 100644
--- a/CST116F2021-Lab3.sln
+++ b/CST116 Lab3 Harris-Toovy.sln
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31424.327
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CST116F2021-Lab3", "CST116F2021-Lab3\CST116F2021-Lab3.vcxproj", "{00A9D643-BD80-4D4E-8CEA-64711FD96DAC}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CST116F2021-Lab3", "CST116F2021-Lab3\CST116 Lab3 Harris-Toovy.vcxproj", "{00A9D643-BD80-4D4E-8CEA-64711FD96DAC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/CST116F2021-Lab3/CST116 Lab3 Harris-Toovy.cpp b/CST116F2021-Lab3/CST116 Lab3 Harris-Toovy.cpp
new file mode 100644
index 0000000..dc999dc
--- /dev/null
+++ b/CST116F2021-Lab3/CST116 Lab3 Harris-Toovy.cpp
@@ -0,0 +1,326 @@
+//Code by Jordan Harris-Toovy for OIT's CST116 course. October 2021
+
+#include <iostream>
+#include <iomanip>
+using namespace std;
+
+//7.2 - Learn by doing exercises #1
+
+/*
+int main()
+{
+ float money = 0.0F;
+ bool has_checkings = 0;
+ bool has_savings = 0;
+
+ cout << "Please enter the amout of money you have (in USD): \n";
+ cin >> money;
+
+ cout << "Do you have a checkings account (enter 0 for no, 1 for yes): \n";
+ cin >> has_checkings;
+
+ cout << "Do you have a savings account (enter 0 for no, 1 for yes): \n";
+ cin >> has_savings;
+
+ cout << "\n\n";
+ cout << "Your account type is: ";
+
+ if (money >= 25000)
+ cout << "Platnum" << endl;
+ else if (money >= 10000)
+ {
+ if (has_checkings == 1 && has_savings == 1)
+ cout << "Gold" << endl;
+ else if ((has_checkings == 1 && has_savings == 0) || (has_checkings == 0 && has_savings == 1))
+ cout << "Silver" << endl;
+ else
+ {
+ cout << "Error" << endl;
+ return 1;
+ }
+ }
+ else
+ cout << "Copper" << endl;
+
+ return 0;
+}
+*/
+
+//7.4 - Learn by doing exercises #1
+
+/*
+int main()
+{
+ cout << "Student Grade Program\n" << " -Main Menu-" << "\n\n";
+ cout << "1. Enter name\n";
+ cout << "2. Enter test scores\n";
+ cout << "3. Display test scores\n";
+ cout << "9. Exit\n\n";
+ cout << "Please enter your choice from the list above: ";
+
+ int user_input = 0;
+ cin >> user_input;
+
+ cout << "\n";
+
+ switch (user_input)
+ {
+ case 1:
+ cout << "This is where you would enter a name if this was more then a menu!\n";
+ break;
+ case 2:
+ cout << "This is where you would enter a test score if this was more then a menu!\n";
+ break;
+ case 3:
+ cout << "This is where you would see test scores if this was more then a menu!\n";
+ break;
+ case 9:
+ cout << "Goodbye\n";
+ break;
+ default:
+ cout << "Invalid input. Exiting\n";
+ return 1;
+ }
+
+ return 0;
+}
+*/
+
+//7.10 - Programing exercises #2
+
+//Pesudocode:
+/*
+DISPLAY promt for interest rate
+GET interest rate from user
+
+DISPLAY promt for loan amount
+GET loan amount from user
+
+IF interest rate is out of range
+DISPLAY error message
+
+IF loan amount is out of range
+DISPLAY error message
+
+IF loan amount is greater than the threshold
+MOVE high fee into varible charge
+OTHERWISE
+MOVE low fee into varible charge
+
+Calculate the interest of the loan amount and add it to varible charge
+
+DISPLAY charge
+*/
+
+/*
+int main()
+{
+ float interest_rate = -1.00F;
+ float principal = -1.00F;
+ float fee = 0.00F;
+ float payment = -1.00F;
+
+ cout << "Enter the interest rate (in percent) of the loan: ";
+ cin >> interest_rate;
+
+ cout << "\nEnter the principal (in USD) of the loan: ";
+ cin >> principal;
+ cout << endl;
+
+ if (interest_rate > 18)
+ {
+ cout << "Interest rate is too high\n";
+ return (1);
+ }
+ else if (interest_rate < 1)
+ {
+ cout << "Interest rate is too low\n";
+ return (2);
+ }
+
+ if (principal > 1000.00F)
+ {
+ cout << "Principal is too large\n";
+ return (3);
+ }
+ else if (principal < 100.00F)
+ {
+ cout << "Principal is too small\n";
+ return (4);
+ }
+
+ if (principal > 500.00F)
+ fee = 25.00F;
+ else
+ fee = 20.00F;
+
+ payment = principal * (interest_rate / 100);
+ payment += fee;
+
+ cout << "\n\nThe payment due for this billing cycle is ";
+ cout.setf(ios::fixed);
+ cout.setf(ios::showpoint);
+ cout.precision(2);
+ cout << payment << " USD\n";
+
+ return (0);
+}
+*/
+
+//8.2 - Learn by doing exercises #1
+
+int main()
+{
+ int max_value = -1;
+
+ cout << "Enter an interger between 1 and 50: ";
+ cin >> max_value;
+
+ //Filter invalid input
+ if ((max_value < 1) || (max_value > 50))
+ {
+ cout << "\n Invalid input";
+ return (1);
+ }
+
+ cout << "The even numbers between " << max_value << " and 0 are: " << endl;
+
+ //Check if even, remove 1 if not
+ if ((max_value % 2) != 0)
+ {
+ max_value--;
+ }
+
+ while (max_value >= 0)
+ {
+ cout << max_value << endl;
+ max_value -= 2;
+ }
+
+ return (0);
+}
+
+//8.4 - Learn by doing exercises #1
+
+//Pseudocode:
+/*
+* DISPLAY loop-length prompt
+* GET num_asign
+*
+* FOR num_asign:
+* DISPLAY score prompt
+* GET num_asign, ADD to scores
+*
+* DIVIDE scores by num_asign
+* DISPLAY scores
+*/
+
+/*
+int main()
+{
+ unsigned int num_asign = 0;
+ float score = 0.0F, temp_score = 0.0F;
+
+ cout << "Enter the number of asignments: ";
+ cin >> num_asign;
+ cout << "\nEnter each score as a percent.\n\n";
+
+ for (int idx = 0; idx < num_asign; idx++)
+ {
+ cout << "Enter score " << idx + 1 << " : ";
+ cin >> temp_score;
+ score += temp_score;
+ cout << endl;
+ }
+
+ score = score / num_asign;
+
+ cout << "The average score is: " << score << endl;
+
+ return (0);
+}
+*/
+
+//8.4 - Learn by doing exercises #2 (NOT IN PROBLEM SET)
+
+/*
+int main()
+{
+ int tri_height = 0;
+ cout << "Enter size of triangle: ";
+ cin >> tri_height;
+ cout << endl;
+
+ if (tri_height > 0)
+ {
+ tri_height--;
+ }
+ else
+ {
+ cout << "Invalid size";
+ return (1);
+ }
+
+ for (tri_height; tri_height >= 0; tri_height--)
+ {
+ for (int tri_width = tri_height; tri_width >= 0; tri_width--)
+ cout << "* ";
+ cout << endl;
+ }
+ return (0);
+}
+*/
+
+//8.10 - Programing exercises #3
+
+//Pseudocode:
+/*
+* DISPLAY user prompt for maximum sequence value
+* GET max_value
+*
+* IF max_value < 1, end
+* ELSE IF max_value = 1, DISPLAY 1, 1
+* ELSE:
+*
+* DISPLAY 1, 1, 2
+* working_v1 = 1
+* working_v2 = 2
+* working_v3 = 2
+*
+* WHILE working_v3 < max_value:
+*
+* working_v3 = working_v1 + working_v2
+* working_v1 = working_v2
+* working_v2 = working_v3
+*
+* DISPLAY working_v3
+*/
+
+/*
+int main()
+{
+ unsigned long long max_val = 0, working_v1 = 1, working_v2 = 1, working_v3 = 2;
+
+ cout << "Enter maximum positive integer for the Fibonacci sequence: ";
+ cin >> max_val;
+ cout << endl;
+
+ if (max_val == 0)
+ cout << "Not in sequence" << endl;
+ else
+ {
+ cout << "1\n1" << endl;
+ while (working_v3 < max_val)
+ {
+ cout << working_v3 << endl;
+ working_v3 = working_v1 + working_v2;
+ working_v1 = working_v2;
+ working_v2 = working_v3;
+ }
+ cout << endl;
+ }
+
+ return (0);
+}
+*/
+
diff --git a/CST116F2021-Lab3/CST116F2021-Lab3.vcxproj.filters b/CST116F2021-Lab3/CST116 Lab3 Harris-Toovy.filters
index 1a7ae88..1a7ae88 100644
--- a/CST116F2021-Lab3/CST116F2021-Lab3.vcxproj.filters
+++ b/CST116F2021-Lab3/CST116 Lab3 Harris-Toovy.filters
diff --git a/CST116F2021-Lab3/CST116F2021-Lab3.vcxproj b/CST116F2021-Lab3/CST116 Lab3 Harris-Toovy.vcxproj
index a706d70..6f63d0c 100644
--- a/CST116F2021-Lab3/CST116F2021-Lab3.vcxproj
+++ b/CST116F2021-Lab3/CST116 Lab3 Harris-Toovy.vcxproj
@@ -139,7 +139,7 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
- <ClCompile Include="CST116F2021-Lab3.cpp" />
+ <ClCompile Include="CST116 Lab3 Harris-Toovy.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
diff --git a/CST116F2021-Lab3/CST116 Lab3 Textual Work Harris-Toovy.txt b/CST116F2021-Lab3/CST116 Lab3 Textual Work Harris-Toovy.txt
new file mode 100644
index 0000000..927750d
--- /dev/null
+++ b/CST116F2021-Lab3/CST116 Lab3 Textual Work Harris-Toovy.txt
@@ -0,0 +1,27 @@
+This file contains all work not applicable to being answered in code/output form.
+
+6.4 Exercises #1:
+0
+2
+3
+3
+2
+
+
+7.1 Exercises #1-6:
+1) Wrong syntax - should be: int_exp1 >= int_exp2
+2) Not a conditional - should be: int_exp1 == int_exp2 (unless you wanted an assignemnt)
+3) Wrong syntax - should be: int_exp1 != int_exp2
+4) "A" is a string, will always evaluate to false - should be: char_exp == 'A'
+5) Mismatched data type - should be: int_exp1 > 66 for clarity (66 is the decimal value of 'B'), although it should work
+6 Wrong syntax - should be: (int_exp1 < 2) && (int_exp1 > -10)
+
+
+6.5 Exercises #1-5:
+1) a += 25
+2) b *= (a * 2)
+3) b++
+4) c %= 5
+5) b /= a
+
+
diff --git a/CST116F2021-Lab3/CST116F2021-Lab3.cpp b/CST116F2021-Lab3/CST116F2021-Lab3.cpp
deleted file mode 100644
index 41af613..0000000
--- a/CST116F2021-Lab3/CST116F2021-Lab3.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-// CST116F2021-Lab3.cpp : This file contains the 'main' function. Program execution begins and ends there.
-//
-
-#include <iostream>
-
-int main()
-{
- std::cout << "Hello World!\n";
-}
-
-// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
-// Debug program: F5 or Debug > Start Debugging menu
-
-// Tips for Getting Started:
-// 1. Use the Solution Explorer window to add/manage files
-// 2. Use the Team Explorer window to connect to source control
-// 3. Use the Output window to see build output and other messages
-// 4. Use the Error List window to view errors
-// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
-// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file
diff --git a/CppProperties.json b/CppProperties.json
new file mode 100644
index 0000000..659bf4e
--- /dev/null
+++ b/CppProperties.json
@@ -0,0 +1,21 @@
+{
+ "configurations": [
+ {
+ "inheritEnvironments": [
+ "msvc_x86"
+ ],
+ "name": "x86-Debug",
+ "includePath": [
+ "${env.INCLUDE}",
+ "${workspaceRoot}\\**"
+ ],
+ "defines": [
+ "WIN32",
+ "_DEBUG",
+ "UNICODE",
+ "_UNICODE"
+ ],
+ "intelliSenseMode": "windows-msvc-x86"
+ }
+ ]
+} \ No newline at end of file