summaryrefslogtreecommitdiffstats
path: root/C++
diff options
context:
space:
mode:
authormsglm <msglm@techchud.xyz>2023-01-14 05:31:48 -0600
committermsglm <msglm@techchud.xyz>2023-01-14 05:31:48 -0600
commit9d53d8857eaa1c9405894a88ca75bc4657e42f35 (patch)
treeeb1efc1d028b949dd83bb710c68be8eff58f26e7 /C++
downloadschool-code-9d53d8857eaa1c9405894a88ca75bc4657e42f35.tar.gz
school-code-9d53d8857eaa1c9405894a88ca75bc4657e42f35.tar.bz2
school-code-9d53d8857eaa1c9405894a88ca75bc4657e42f35.zip
Inital CommitHEADmaster
Diffstat (limited to 'C++')
-rw-r--r--C++/2D Arrays/2D Arrays.cpp44
-rw-r--r--C++/2D Arrays/INSTRUCTIONS32
-rw-r--r--C++/ArrayExamples/ArrayExamples.cpp73
-rw-r--r--C++/ArraySearchExample/ArraySearchExample.cpp66
-rw-r--r--C++/Arrays/Files, Functions and Arrays bloatless version.cpp78
-rw-r--r--C++/Arrays/Files, Functions and Arrays.cpp111
-rwxr-xr-xC++/Arrays/bloatbin0 -> 26032 bytes
-rwxr-xr-xC++/Arrays/bloatlessbin0 -> 18232 bytes
-rw-r--r--C++/Arrays/in.txt10
-rw-r--r--C++/Arrays/instructions36
-rw-r--r--C++/Arrays/out.txt19
-rw-r--r--C++/Ch6Practice1/Ch6Practice1.cpp97
-rw-r--r--C++/Circle/Circle.cpp32
-rw-r--r--C++/Cube/Cube.cpp25
-rw-r--r--C++/DoWhileLoopPractice/DoWhileLoopPractice.cpp67
-rw-r--r--C++/DoWhileLoopPractice/NestedLoop-TriangleDrawing/NestedLoop-TriangleDrawing.cpp36
-rw-r--r--C++/Earnings/Earnings.cpp43
-rw-r--r--C++/ExamAverage/Based/ExamAverage.cpp55
-rw-r--r--C++/ExamAverage/Exam Average Program - planning sheet.docxbin0 -> 22546 bytes
-rw-r--r--C++/ExamAverage/Exam Average Program - planning sheet.odtbin0 -> 31386 bytes
-rw-r--r--C++/ExamAverage/Exam Average Program - planning sheet.pdfbin0 -> 65464 bytes
-rw-r--r--C++/ExamAverage/ExamAverage.cpp35
-rw-r--r--C++/ExamAverage2/ExamAverage2.cpp40
-rw-r--r--C++/Final Program/Final.cpp247
-rw-r--r--C++/Final Program/INSTRUCTIONS50
-rw-r--r--C++/Final Program/person.h15
-rw-r--r--C++/Final/Final Program Instruction (1).docxbin0 -> 152126 bytes
-rw-r--r--C++/Final/Final Program.cpp134
-rw-r--r--C++/Final/Final Project Grade Sheet .pdfbin0 -> 183679 bytes
-rw-r--r--C++/Final/hourlyinput.txt10
-rw-r--r--C++/Final/hourlyoutput.txt11
-rw-r--r--C++/FindLargestNumber/FindLargestNumber.cpp39
-rw-r--r--C++/ForLoopPractice/ForLoopPractice.cpp44
-rw-r--r--C++/GuessingGame/Guessing Game Program Instructions.docxbin0 -> 19199 bytes
-rw-r--r--C++/GuessingGame/GuessingGame.cpp89
-rwxr-xr-xC++/HelloWorld/HelloWorldbin0 -> 16561 bytes
-rw-r--r--C++/HelloWorld/HelloWorld.cpp6
-rw-r--r--C++/Inheritance/INSTRUCTIONS35
-rw-r--r--C++/Inheritance/Inheritance.cpp102
-rw-r--r--C++/Inheritance/person.h12
-rw-r--r--C++/Intro to Object-Oriented Programming/WhatIsOOP.docxbin0 -> 7874 bytes
-rw-r--r--C++/Introduction/Introduction.cpp26
-rw-r--r--C++/LengthInFeetPlusInchesRemainder/LengthInFeetPlusInchesRemainder.cpp19
-rw-r--r--C++/Menu System/Instruction51
-rw-r--r--C++/Menu System/MenuSystem.cpp255
-rw-r--r--C++/Menu System/appetizer.txt52
-rw-r--r--C++/Menu System/dessert.txt52
-rw-r--r--C++/Menu System/drink.txt52
-rw-r--r--C++/Menu System/entree.txt52
-rw-r--r--C++/Midterm/Instructions.txt45
-rw-r--r--C++/Midterm/Midterm.cpp280
-rw-r--r--C++/Midterm/input.txt93
-rw-r--r--C++/Multiple Inheritance/INSTRUCTIONS43
-rw-r--r--C++/Multiple Inheritance/MultiInheritance.cpp280
-rw-r--r--C++/Multiple Inheritance/diamond.pngbin0 -> 21636 bytes
-rw-r--r--C++/NestedLoop-TriangleDrawing/NestedLoop-TriangleDrawing.cpp62
-rw-r--r--C++/NewSummerJob/NewSummerJob.cpp84
-rw-r--r--C++/OOP/INSTRUCTIONS43
-rw-r--r--C++/OOP/OOP.cpp205
-rw-r--r--C++/ParallelArray/ParallelArray.cpp53
-rw-r--r--C++/Pointers/Pointers.cpp87
-rw-r--r--C++/Polymorphism/INSTRUCTIONS47
-rw-r--r--C++/Polymorphism/Polymorphism.cpp155
-rw-r--r--C++/Polymorphism/PolymorphismTooCool.cpp205
-rw-r--r--C++/Polymorphism/input.txt1
-rw-r--r--C++/Rectangle/Rectangle.cpp33
-rw-r--r--C++/RestaurantBill/RestaurantBill.cpp55
-rw-r--r--C++/Sales Array Program/.~lock.Ch 8 Sales Array Program.docx#1
-rw-r--r--C++/Sales Array Program/Ch 8 Sales Array Program.docxbin0 -> 52253 bytes
-rw-r--r--C++/Sales Array Program/SalesArrayProgram.cpp94
-rw-r--r--C++/Sales Array Program/daily_sales.txt7
-rw-r--r--C++/SortArrayExample1/SortArrayTemplate1.cpp71
-rw-r--r--C++/SortArrayExample2/SortArrayTemplate2.cpp76
-rw-r--r--C++/Sorting Data/SortingData.cpp138
-rw-r--r--C++/Sorting Data/fname.txt100
-rw-r--r--C++/Sorting Data/lname.txt100
-rw-r--r--C++/String Processing/String Processing.cpp88
-rw-r--r--C++/StringExample/StringExample.cpp57
-rw-r--r--C++/Structs/INSTRUCTIONS44
-rw-r--r--C++/Structs/Structs.cpp112
-rw-r--r--C++/Structs/input.txt7
-rw-r--r--C++/StudentScoreWithLoop/studentScore.txt6
-rw-r--r--C++/StudentScoreWithLoop/studentScoreWithLoop.cpp63
-rw-r--r--C++/StudentScoreWithLoop/testavg.out4
-rw-r--r--C++/SumOfIntegers/SumOfIntegers.cpp79
-rw-r--r--C++/SumOfRange/Sum of Range program instruction.docxbin0 -> 19551 bytes
-rw-r--r--C++/SumOfRange/SumOfRange.cpp87
-rw-r--r--C++/SummerJob/Summer Job Program - planning sheet.docxbin0 -> 40013 bytes
-rw-r--r--C++/SummerJob/Summer Job Program - planning sheet.odtbin0 -> 41323 bytes
-rw-r--r--C++/SummerJob/Summer Job Program - planning sheet.pdfbin0 -> 93477 bytes
-rw-r--r--C++/SummerJob/SummerJob.cpp56
-rw-r--r--C++/TakeOrderV1/.~lock.Take Order Program Instructions (v1).docx#1
-rw-r--r--C++/TakeOrderV1/Take Order Program Instructions (v1).docxbin0 -> 126173 bytes
-rw-r--r--C++/TakeOrderV1/TakeOrderV1.cpp101
-rw-r--r--C++/TakeOrderV2/Take Order Program Instructions (v2).docxbin0 -> 126444 bytes
-rw-r--r--C++/TakeOrderV2/TakeOrderV2.cpp203
-rw-r--r--C++/TakeOrderV2/instructions.txt7
-rw-r--r--C++/Test1/BookStoreReceipt.cpp58
-rw-r--r--C++/Test1/ErrorCorrection.cpp66
-rw-r--r--C++/Test2/Exam 2 Program Instruction.docxbin0 -> 13467 bytes
-rw-r--r--C++/Test2/RPS.cpp101
-rw-r--r--C++/Test3/Program1.cpp65
-rw-r--r--C++/Test3/Program2.cpp108
-rw-r--r--C++/TwoDimensionalArray/TwoDimensionalArray.cpp55
-rw-r--r--C++/TwoDimensionalArray/student_data.txt5
-rw-r--r--C++/ValueVsReference/ValueVsReference.cpp56
-rw-r--r--C++/Vectors/Vectors.cpp139
-rw-r--r--C++/Vectors/input.txt50
-rw-r--r--C++/Vectors/instructions.txt39
-rw-r--r--C++/Videos/Chapter 5 (highlighting Do-While loop and Nested loop) 3-4-22 .mp4bin0 -> 68686466 bytes
-rw-r--r--C++/Virtual Functions/INSTRUCTIONS34
-rw-r--r--C++/Virtual Functions/VirtualFunctions.cpp56
-rw-r--r--C++/Week7-Practice1/Ch3_Ex5Data.txt3
-rw-r--r--C++/Week7-Practice1/Ch3_Ex5Output.dat3
-rw-r--r--C++/Week7-Practice1/practice1.cpp61
-rw-r--r--C++/WhileLoopPractice/WhileLoopPractice.cpp52
-rw-r--r--C++/cinErrorExample/cinErrorExample output(1).docxbin0 -> 56355 bytes
-rw-r--r--C++/cinErrorExample/cinErrorExamples.cpp42
-rw-r--r--C++/cubeSwitch/Ch 4 Cube program instructions.docxbin0 -> 28802 bytes
-rw-r--r--C++/cubeSwitch/cubeSwitch.cpp95
-rw-r--r--C++/getlineAndCinPractice/getLineCin.cpp67
-rw-r--r--C++/manipulatorPractice/manipulatorPractice.cpp56
-rw-r--r--C++/shapeWithFunctions/shapesWithFunctions.cpp135
-rw-r--r--C++/shapes/Ch 4 Shapes program and planning sheet(2).docxbin0 -> 34985 bytes
-rw-r--r--C++/shapes/shape.cpp102
-rw-r--r--C++/shapesWithLoop/shapesWithLoops.cpp118
-rw-r--r--C++/stepsCount/Steps Count- Input and Output Files.docxbin0 -> 19553 bytes
-rw-r--r--C++/stepsCount/inputData.txt1
-rw-r--r--C++/stepsCount/stepCount.cpp94
-rw-r--r--C++/stepsCount/stepsFormated.txt9
-rw-r--r--C++/studentScore/studentScore.cpp73
-rw-r--r--C++/studentScore/studentScore.txt6
-rw-r--r--C++/studentScore/testavg.out4
-rw-r--r--C++/sumOfRange/Sum of Range program instruction.docxbin0 -> 19551 bytes
134 files changed, 7278 insertions, 0 deletions
diff --git a/C++/2D Arrays/2D Arrays.cpp b/C++/2D Arrays/2D Arrays.cpp
new file mode 100644
index 0000000..d18f148
--- /dev/null
+++ b/C++/2D Arrays/2D Arrays.cpp
@@ -0,0 +1,44 @@
+// Name: msglm
+// Date: Nov 25th 2022
+// Program Name: 2D Arrays
+// Description:
+
+
+#include <iostream>
+#include <string>
+using namespace std;
+
+//classes
+class Person {
+ public:
+ string movies[2][4];
+ void getMovies() {
+ cout << "Enter your favorite movies: \n";
+ for(int x = 0; x < 2; x++) {
+ for(int y = 0; y < 4; y++) {
+ cout << "This will be going in position: (" << x << "," << y << ")\n";
+ getline(cin,movies[x][y]);
+ }
+ }
+ }
+ void output() {
+ for(int x = 0; x < 2; x++) {
+ for(int y = 0; y < 4; y++) {
+ cout << movies[x][y] << endl;
+ }
+ }
+ }
+};
+
+int main() {
+ Person person;
+ person.getMovies();
+ person.output();
+}
+/*
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License Version 3 ONLY as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
diff --git a/C++/2D Arrays/INSTRUCTIONS b/C++/2D Arrays/INSTRUCTIONS
new file mode 100644
index 0000000..924f32d
--- /dev/null
+++ b/C++/2D Arrays/INSTRUCTIONS
@@ -0,0 +1,32 @@
+HW4: 2D Arrays
+Due November 29th, 2022 before midnight
+50 Points
+2D Arrays are only introduced in this course. You will use them in data structures instead. Therefore, this assignment is meant to let you become familiar with the concept before you move onto that class.
+In this assignment, you will watch the videos about 2D Arrays. Then, you will write a program that does the following:
+
+ Write a program using 2D Arrays that will store information from a user where they enter their favorite movie names. It is up to you to decide how many movie names will be entered
+ Output the information entered back onto the screen
+
+Assignment Notes:
+
+ This program will be written in an OOP environment using functions where possible
+ Use functions to get the data and to output the data
+ Keep the program short! This is not meant to be a big assignment. :D
+ You can look up information about 2D arrays if you need additional examples, but please, no copy/paste! Copy/paste = 0/50
+
+General Notes:
+Be sure to use comments in your program: Name, Program Description, Date and anywhere else in the program you deem necessary.
+Grading Rubric:
+
+ If you do not include comments at the top of the program (name, program description, date), you will lose 15 points
+ If your program is not object-oriented, you will receive a 0/50(OOP is requred for this assignment)
+ If your work is late (within 48 hours of the due date), you will lose 25 points
+ If your program is late beyond the 48 hour due date, I will typically still accept it, but you will lose far more points. Depends on when you turn it in
+ If your program is not formatted nicely (code all over the place, ugly), you will lose up to 25 points depending on the extent
+ If your program stops working when I run it, you will lose points. The exact amount depends on the severity of the error
+ If your program still has your friend's name on it, I will send you a message asking you to try harder while giving you a 0/50
+ If you submit a file type I cannot open, such as .sln, you will receive a 0/50. You will be able to resubmit for credit, but you will lose points (depending on how late it is)
+ If your program looks like a a professional programmer wrote it, I will write to you to ask if you want a job. Well, maybe not. But, I will ask about the code
+ This is just a list of typical issues I run into when grading to give you some idea of where your points go. Points can be taken off for other reasons.
+
+
diff --git a/C++/ArrayExamples/ArrayExamples.cpp b/C++/ArrayExamples/ArrayExamples.cpp
new file mode 100644
index 0000000..119a709
--- /dev/null
+++ b/C++/ArrayExamples/ArrayExamples.cpp
@@ -0,0 +1,73 @@
+// Name: msglm
+// Date:
+// Program Name:
+// Description:
+
+
+#include <iostream>
+#include <string>
+#include <iomanip>
+using namespace std;
+
+// Named constants
+
+const int ARRAY_SIZE = 5;
+
+int main() {
+ //Variable declaration
+ int num[ARRAY_SIZE]; //Declaring array size
+ int maxIndex;
+ int minIndex;
+ int sum = 0;
+
+ //Program title and description for the user
+
+ cout << "Array Example : This program will sho whow to declare, init, and raverse through \n an array. and find largest, smallest, sum, and average value.\n";
+
+ //get ints from user to initialize
+ for (int i = 0 ; i < ARRAY_SIZE; i++) {
+ cout << "Enter Value " << i+1 << ": " << endl;
+ cin >> num[i];
+ }
+ cout << endl;
+
+ //Check input by printing to the console
+ for (int i = 0 ; i < ARRAY_SIZE; i++) {
+ cout << "num[" << i << "]= " << num[i] << endl;
+ }
+
+ //Find largest value
+ maxIndex = 0;
+ for (int i = 0; i < ARRAY_SIZE; i++) {
+ if(num[maxIndex] < num[i]) {
+ maxIndex = i;
+ }
+ }
+ cout << "Largest Value: " << num[maxIndex] << endl;
+
+ //Find smallest value
+ minIndex = 0;
+ for (int i = 0; i < ARRAY_SIZE; i++) {
+ if(num[minIndex] > num[i]) {
+ minIndex = i;
+ }
+ }
+ cout << "Largest Value: " << num[minIndex] << endl;
+
+ float average;
+ //Find sum and average
+ for (int i = 0; i < ARRAY_SIZE; i++) {
+ sum = sum + num[i];
+ }
+ average = sum/ARRAY_SIZE;
+
+ cout << "Sum: " << sum << endl;
+ cout << "Average: " << average << endl;
+}
+
+ /*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/ArraySearchExample/ArraySearchExample.cpp b/C++/ArraySearchExample/ArraySearchExample.cpp
new file mode 100644
index 0000000..ce686e9
--- /dev/null
+++ b/C++/ArraySearchExample/ArraySearchExample.cpp
@@ -0,0 +1,66 @@
+// Name: msglm
+// Date:
+// Program Name:
+// Description:
+
+
+#include <iostream>
+#include <string>
+#include <iomanip>
+using namespace std;
+
+// Named constants
+
+const int ARRAY_SIZE = 7;
+
+int main() {
+ //Variable Declaration
+ int list[ARRAY_SIZE] = {45, 12, 27, 12, 45, 12, 38};
+ int num;
+ bool isFound = false;
+ int count_num = 0;
+
+ //Program Title
+ cout << "Searching an Array" << endl << endl;
+
+ // Ask the user for input num
+ cout << "What integer would you like to search for?\n";
+ cin >> num;
+
+ for ( int i = 0; i < ARRAY_SIZE; i++ ) {
+ if (list[i] == num) {
+ isFound = true;
+ break;
+ }
+ }
+
+ if (isFound) {
+ cout << "The number " << num << " is in the list " << endl;
+ } else {
+ cout << "The number " << num << " is not in the list" << endl;
+ }
+
+ //Print number of time s a number is found in the list
+ for ( int i = 0; i < ARRAY_SIZE; i++ ) {
+ if (list[i] == num) {
+ count_num++;
+ }
+ }
+ cout << "The number " << num << " is in the list " << count_num << " times";
+
+ //Print the location where the number is found in the list
+ cout << "\nThe number is in locations: " << endl;
+
+ for (int i = 0; i < ARRAY_SIZE; i++ ) {
+ if (list[i] == num) {
+ cout << "list[" << i << "] " << endl;
+ }
+ }
+}
+
+ /*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/Arrays/Files, Functions and Arrays bloatless version.cpp b/C++/Arrays/Files, Functions and Arrays bloatless version.cpp
new file mode 100644
index 0000000..963feef
--- /dev/null
+++ b/C++/Arrays/Files, Functions and Arrays bloatless version.cpp
@@ -0,0 +1,78 @@
+// Name: msglm
+// Date:
+// Program Name:
+// Description:
+
+
+#include <iostream>
+#include <fstream>
+#include <string>
+using namespace std;
+
+// Named constants
+int ARR_SIZE = 50; //Personally, i'd pass this as an env var or a flag
+
+int main() {
+
+ //Variable declaration
+ string tmpArr[ARR_SIZE]; //Probably could pass through the file first to get the size first and declare this, but that's past this program's scope.
+ int epoch = 0; //both counts up and is the length of the array.
+
+ //Vars necessary to invert an array
+ int start = 0;
+ string tmp;
+ int end = 0;
+
+ //It's a shame this isn't STDIN and STDOUT
+ ifstream inFile;
+ ofstream outFile;
+
+ // User input
+ if (inFile) {
+
+ inFile.open("in.txt");
+ outFile.open("out.txt");
+
+ //Read the line, put it at the epoch in the array, also check if EOF. if EOF, abort.
+ while(getline(inFile, tmpArr[epoch]) && inFile.peek() != EOF) {
+ cout << tmpArr[epoch] << endl;
+ outFile << tmpArr[epoch] << endl;
+ epoch = epoch + 1;
+ }
+
+ //Epoch is assumed to be the length of the variable at this point, so will use accordingly
+ end = epoch;
+
+ //exchange the positions of the first and last var in an array while slowly moving to the center
+ //i.e
+ //on first pass of the while look will turn [1, 2, 3, 4] into [4, 2, 3, 1]
+ //and the second will turn [4, 3, 2, 1]
+ //
+ //I opted to use this algorithm to not create any more data
+ while (start < end) {
+ tmp = tmpArr[start];
+ tmpArr[start] = tmpArr[end];
+ tmpArr[end] = tmp;
+ start = start + 1;
+ end = end - 1;
+ }
+ //finally, output the reversed array and dump it into a file
+ for(int i=0;i<epoch+1;i++) {
+ cout << tmpArr[i] << endl;
+ outFile << tmpArr[i] << endl;
+ }
+
+ return 0;
+ } else {
+ cout << "ERROR. Input File doesn't exist!";
+ return 1;
+
+ }
+}
+/*
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License Version 3 ONLY as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
diff --git a/C++/Arrays/Files, Functions and Arrays.cpp b/C++/Arrays/Files, Functions and Arrays.cpp
new file mode 100644
index 0000000..2ce808a
--- /dev/null
+++ b/C++/Arrays/Files, Functions and Arrays.cpp
@@ -0,0 +1,111 @@
+// Name: msglm
+// Date: August 25th 2022
+// Program Name: Files, Functions and Arrays
+// Description: Create a program that reads in an unknown number of ATU class names (such as Programming 2) from an input file (see explanation of unknown number below). Then, output those class names to both the screen and an output file - output once in the order in which the data was read in from the file and again in reverse order.
+
+
+
+#include <iostream>
+#include <fstream>
+#include <string>
+using namespace std;
+
+// Named constants
+const int ARR_SIZE = 50; //Personally, i'd pass this as an env var or a flag
+
+
+//Global Variable declaration
+//
+//Usually this is bad practice, but the function requirement for this has forced me to partake in this
+//I could have done some mess with passing by reference, but every function was assumed to share the same data
+//(I wrote it all in main first and then fragmented it), so this is the best way I could find to reach requirement
+//
+//Something like this should never reach production ever.
+
+string tmpArr[ARR_SIZE]; //Probably could pass through the file first to get the size first and declare this, but that's past this program's scope.
+int epoch {}; //both counts up and is the length of the array.
+
+//Vars necessary to invert an array
+int start {};
+string tmp;
+int arrEnd {}; //Conflicts with namespace, hence the name
+
+//It's a shame this isn't STDIN and STDOUT
+ifstream inFile;
+ofstream outFile;
+
+
+//Functions are pretty unncessary for this code and overcomplicate more than they help
+//The original code for this before I split it into 5 functions was a cute little 40 SLOC thing.
+
+bool fileFound(string location) {
+ ifstream testFile;
+ testFile.open(location);
+
+ if (testFile) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+void orderArray() {
+ //Read the line, put it at the epoch in the array, also check if EOF. if EOF, abort.
+ while(getline(inFile, tmpArr[epoch]) && inFile.peek() != EOF) {
+ epoch = epoch + 1;
+ }
+
+}
+
+void displayNormalOrderArray() {
+ int i = 0;
+ while(i<epoch){
+ cout << tmpArr[i] << endl;
+ outFile << tmpArr[i] << endl;
+ i++;
+ }
+
+}
+
+void reverseOrderArray() {
+ //the skip of the last digit is purposeful, the other loop covers it
+ for(int i=epoch;i>=0;i--) {
+ cout << tmpArr[i] << endl;
+ outFile << tmpArr[i] << endl;
+ }
+}
+
+void closeFiles() {
+ inFile.close();
+ outFile.close();
+}
+
+int main() {
+
+ //Var assignments
+
+ // User input
+ if (fileFound("in.txt")) {
+
+ inFile.open("in.txt");
+ orderArray();
+ outFile.open("out.txt");
+ displayNormalOrderArray();
+ reverseOrderArray();
+ closeFiles();
+
+ return 0;
+
+ } else {
+ cout << "ERROR. Input File doesn't exist!";
+ return 1;
+
+ }
+}
+/*
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License Version 3 ONLY as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
diff --git a/C++/Arrays/bloat b/C++/Arrays/bloat
new file mode 100755
index 0000000..e39fad8
--- /dev/null
+++ b/C++/Arrays/bloat
Binary files differ
diff --git a/C++/Arrays/bloatless b/C++/Arrays/bloatless
new file mode 100755
index 0000000..98d671b
--- /dev/null
+++ b/C++/Arrays/bloatless
Binary files differ
diff --git a/C++/Arrays/in.txt b/C++/Arrays/in.txt
new file mode 100644
index 0000000..f00c965
--- /dev/null
+++ b/C++/Arrays/in.txt
@@ -0,0 +1,10 @@
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
diff --git a/C++/Arrays/instructions b/C++/Arrays/instructions
new file mode 100644
index 0000000..d09b59d
--- /dev/null
+++ b/C++/Arrays/instructions
@@ -0,0 +1,36 @@
+
+Project 1: Files, Functions and Arrays
+Due: Friday, August 26th, 2022 before midnight
+100 Points
+Problem Statement:
+Create a program that reads in an unknown number of college-name class names (such as Programming 2) from an input file (see explanation of unknown number below). Then, output those class names to both the screen and an output file - output once in the order in which the data was read in from the file and again in reverse order.
+Step-by-step instructions:
+
+ Create an array variable to store string values. Make this array variable so it can store up to 50 values in it. When declaring that array variable, use a constant int to allocate the size.
+ Create an input file variable to read in the class name data. Create an output file variable to store output
+ Use a loop of your choice to read in an unknown number of values from your input file and store that data into the array variable you created in step 1 (unknown number values: this means the number of data items stored in the file size is not static. It can change each time the program executes)
+ Use getline to read in string values from your input file so you may capture values with spaces in them
+ After reading in the class names from the input file and storing them into your array variable, output them to both the screen and an output file in the original order and again in reverse order
+ Use functions to do the following:
+ Check to see if the file was found
+ Read in the class names
+ Output the class names to the screen in the original order
+ Output the class names in reverse order
+ Close the files
+
+Be sure to use comments in your program: Name, Program Description, Date and anywhere else in the program you deem necessary.
+***NOTE*** Here is an explanation of unknown number of records - Example: Let's say we want to read in from an input file the names of students attending class each class day. The number of students attending class varies because students sometimes miss class. Therefore, we do not know how many names will be read into our program when we take roll. Therefore, we need to build our system to handle this issue. In the assignment I asked you to create, you do not know how many class names will be inside of the input file. It could be 2 or 5 or 20. We don't know. So, you will need to write you program to handle this problem. Ths is simply using a while loop to read until the end of file is reached. I discuss how to do this in the video lectures on files. The only real problem is if the number of records read in from the input file exceeds the the array allocation. Example: string classNames[10]; and I try to read in 20 class names. This is not possible. To prevent this issue, you need to set your allocation to a value that likely be higher so this issue does not occur.
+If you are stuck, no worries. I will help in class and through email.
+Grading Rubric:
+
+ If you do not include comments at the top of the program (name, program description, date), you will lose 15 points
+ If you do not use functions, you will use 10 points per missing function (50 points possible)
+ If your program does not compile (run), then I will give a grade of 0/100. But will give you the change to repair for points back (some points are better than none)
+ If your program is late (within 48 hours of the due date), you will lose 25 points
+ If your program is not formatted nicely (code all over the place, ugly), you will lose up to 25 points depending on the severity
+ If your program stops working when I run it, you will lose points. The amount depends on the severity of the error
+ If your program is identical to another student's work, I will contact both students for a conference where you may both receive a 0/100 for your project
+ If your program looks like a a professional programmer wrote it, I will contact you to determine if you did indeed write the program or copy off of the internet, you may receive a 0/100 for copying
+ This is just a list of typical issues I run into when grading to give you some idea of where your points go. Points can be taken off for other reasons.
+
+
diff --git a/C++/Arrays/out.txt b/C++/Arrays/out.txt
new file mode 100644
index 0000000..80c0dcc
--- /dev/null
+++ b/C++/Arrays/out.txt
@@ -0,0 +1,19 @@
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+9
+8
+7
+6
+5
+4
+3
+2
+1
diff --git a/C++/Ch6Practice1/Ch6Practice1.cpp b/C++/Ch6Practice1/Ch6Practice1.cpp
new file mode 100644
index 0000000..4623714
--- /dev/null
+++ b/C++/Ch6Practice1/Ch6Practice1.cpp
@@ -0,0 +1,97 @@
+// Name: msglm
+// Date:
+// Program Name:
+// Description:
+
+
+#include <iostream>
+#include <string>
+#include <iomanip>
+using namespace std;
+
+//Function header (probably should be in a header file)
+int civi_to_mili(int startTime, string meridian);
+int mili_to_civi(int startTime, string &meridian);
+
+// Named constants
+
+int main() {
+
+ //Variable declaration
+ int hour;
+ int minute;
+ int choice;
+ string meridian;
+ int trueHour;
+ //Program title and description for the user
+ cout << "Title: Military-To-Civilian time converter" << endl << "Description: converts military to civilian time and vice-versa" << endl;
+ do {
+
+ // User input
+ cout << "Enter the hour" << endl;
+ cin >> hour;
+
+ cout << "Enter the minute" << endl;
+ cin >> minute;
+ trueHour = hour;
+
+ cout << "AM or PM? (either works if military time)" << endl;
+ cin >> meridian;
+
+ if (!cin) {
+ cin.clear();
+ cin.ignore(100, '\n');
+ }
+
+ } while (!cin);
+
+ do {
+ cout << "1. Convert Civi to Mili\n";
+ cout << "2. Convert Mili to Civi\n";
+ cout << "3. Print current time\n";
+ cout << "4. Exit\n";
+ cout << "Choice: \n";
+ cin >> choice;
+ if (choice == 1) {
+ trueHour = civi_to_mili(trueHour, meridian);
+ cout << "\033[2J\033[1;1H";
+ cout << "time: \n";
+ cout << trueHour << ":" << minute << " " << meridian << endl;
+ } else if (choice == 2) {
+ trueHour = mili_to_civi(trueHour, meridian);
+ cout << "\033[2J\033[1;1H";
+ cout << "time: \n";
+ cout << trueHour << ":" << minute << " " << meridian << endl;
+ } else if (choice == 3) {
+ cout << "\033[2J\033[1;1H";
+ cout << "time: \n";
+ cout << trueHour << ":" << minute << " " << meridian << endl;
+ } else {
+ return 0;
+ }
+ } while (cin);
+}
+
+int civi_to_mili(int startTime, string meridian) {
+ if (meridian == "PM"){
+ return startTime + 12;
+ } else {
+ return startTime;
+ }
+}
+int mili_to_civi(int startTime, string &meridian) {
+ if (startTime > 12){
+ meridian = "PM";
+ return startTime-12;
+ } else {
+ meridian = "AM";
+ return startTime;
+ }
+}
+
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/Circle/Circle.cpp b/C++/Circle/Circle.cpp
new file mode 100644
index 0000000..11bb9e3
--- /dev/null
+++ b/C++/Circle/Circle.cpp
@@ -0,0 +1,32 @@
+// Name: msglm
+// Introduction: Circle Program
+// Description: Program to compute and output the area/circumference of a circle by inputting a radius.
+
+#include <iostream>
+#include <string>
+#include <numbers>
+#include <cmath>
+using namespace std;
+int main() {
+ float inputRadius;
+ string measurement;
+ const double pi = 3.14;
+
+ cout << "Please Input the Desired Radius for your Circle: ";
+ cin >> inputRadius;
+
+ cout << "What measurement would you like to use?: ";
+ cin >> measurement;
+
+ cout << "Radius: " << inputRadius << measurement << endl;
+ cout << "Circumference: " << 2*pi*inputRadius << measurement << endl;
+ cout << "Area: " << pi*pow(inputRadius, 2) << measurement << endl;
+
+}
+
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/Cube/Cube.cpp b/C++/Cube/Cube.cpp
new file mode 100644
index 0000000..b66a240
--- /dev/null
+++ b/C++/Cube/Cube.cpp
@@ -0,0 +1,25 @@
+// Name: msglm
+// Introduction: Cube Program
+// Description: A program that will find the surface area and volume of a cube.
+
+
+#include <iostream>
+#include <cmath>
+using namespace std;
+int main() {
+ float sideLength;
+ float sideArea;
+
+ sideLength = 6.0; //A good program would allow user input via command line arguments.
+ cout << "Cube Surface Area Is: " << 6*pow(sideLength, 2) << " Cubed Inches \n";
+ cout << "Cube Volume Is: " << pow(sideLength, 3) << " Cubed Inches \n";
+
+ return 0;
+}
+
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/DoWhileLoopPractice/DoWhileLoopPractice.cpp b/C++/DoWhileLoopPractice/DoWhileLoopPractice.cpp
new file mode 100644
index 0000000..d6bc9aa
--- /dev/null
+++ b/C++/DoWhileLoopPractice/DoWhileLoopPractice.cpp
@@ -0,0 +1,67 @@
+// Name: msglm
+// Date:
+// Program Name:
+// Description:
+
+
+#include <iostream>
+#include <string>
+#include <iomanip>
+using namespace std;
+
+// Named constants
+
+int main() {
+
+ //Variable declaration
+ int i;
+ int score;
+ int choice;
+
+ // Example 1
+ cout << "Do While Loop Example 1" << endl;
+
+ i = 11;
+
+ do {
+ cout << i << " " << endl;
+ i = i + 5;
+ } while( i <= 30 );
+
+ cout << "Out of the Loop!" << endl << endl;
+
+ //Example 2
+
+ cout << "Do While Loop Example 2" << endl;
+
+ do {
+ cout << "Enter a score between 0 and 50" << endl;
+ cin >> score;
+ cout << endl;
+
+ if(score < 0 || score > 50) {
+ cout << "It is an invalid input" << endl;
+ }
+ } while (score < 0 || score > 50);
+ cout << "That was a valid input" << endl;
+
+ cout << "Do While Loop Example 3" << endl;
+
+ cout << "Menu Options" << endl << endl;
+ cout << "1 - Option 1" << endl;
+ cout << "2 - Option 2" << endl;
+ cout << "3 - Option 3" << endl;
+
+ do {
+ cout << "Enter your choice:" << endl;
+ cin >> choice;
+ } while(choice<1||choice>3);
+ cout << "Your choice is: " << choice << endl;
+}
+
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/DoWhileLoopPractice/NestedLoop-TriangleDrawing/NestedLoop-TriangleDrawing.cpp b/C++/DoWhileLoopPractice/NestedLoop-TriangleDrawing/NestedLoop-TriangleDrawing.cpp
new file mode 100644
index 0000000..70f43ce
--- /dev/null
+++ b/C++/DoWhileLoopPractice/NestedLoop-TriangleDrawing/NestedLoop-TriangleDrawing.cpp
@@ -0,0 +1,36 @@
+// Name: msglm
+// Date:
+// Program Name:
+// Description:
+
+
+#include <iostream>
+#include <string>
+#include <iomanip>
+using namespace std;
+
+// Named constants
+
+int main() {
+
+ //Variable declaration
+
+ int i, j;
+ cout << "Nested loop practice - drawing triangles";
+
+ for (i = 1; i <= 5; i++) {
+
+ for (j = i ; j <=i ; j++)
+ cout << "*";
+ cout << endl;
+ }
+
+
+}
+
+ /*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/Earnings/Earnings.cpp b/C++/Earnings/Earnings.cpp
new file mode 100644
index 0000000..fd1ca98
--- /dev/null
+++ b/C++/Earnings/Earnings.cpp
@@ -0,0 +1,43 @@
+// Name: msglm
+// Introduction: Earnings
+// Description: a program that will determine how much an employee earned in a given time period
+
+
+#include <iostream>
+#include <string>
+using namespace std;
+int main() {
+
+ string name;
+ double payRate;
+ int hours;
+
+ cout << "What is your name?: ";
+
+ //Get the full name of the user
+ getline(cin, name);
+
+ //Obtain payrate
+ cout << "What is your payrate (per hour)?: ";
+ cin >> payRate;
+
+ //Obtain hours worked
+ cout << "How many hours have you worked?: ";
+ cin >> hours;
+
+ //Output calculated information. payRate*hours is a standard equation
+ cout << "Name: " << name << endl;
+ cout << "Pay rate: " << "$" << payRate << endl;
+ cout << "Hours Worked: " << hours << endl;
+ cout << "Earnings: " << "$" << payRate*hours << endl;
+
+ return 0;
+
+}
+
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/ExamAverage/Based/ExamAverage.cpp b/C++/ExamAverage/Based/ExamAverage.cpp
new file mode 100644
index 0000000..b189b94
--- /dev/null
+++ b/C++/ExamAverage/Based/ExamAverage.cpp
@@ -0,0 +1,55 @@
+// Name: msglm
+// Introduction: Exam Average
+// Description: Calculates the average score between exams given exam scores.
+
+
+#include <iostream>
+#include <string>
+#include <vector>
+using namespace std;
+int main() {
+
+ float temporaryUserInput;
+ float totalScore = 0;
+ vector<float> testScores;
+
+ cout << "Please input your test scores: \nWhen finished, type any non-number input: \n";
+
+ //While loop that tests if temporaryUserInput is not valid input; terminate if not valid
+ while (1) {
+
+ //Cin that writes to temporaryUserInput
+ cin >> temporaryUserInput;
+
+ //if temporaryUserInput is a number, append temporaryUserInput to testScores & loop over
+ if(cin.fail() && testScores.size() == 0) {
+ cout << "You Terminated the program without giving proper input! Shame on You! \n";
+ return(1);
+ } else if (cin.fail()){
+ //otherwise, break the loop and move on to calculating averages
+ break;
+ } else {
+ //This is the point where the test scores are appended to and a loop happens
+ testScores.push_back(temporaryUserInput);
+ }
+ }
+
+ //for every number in the vector testScores, add that number to testScoresSum
+ for (int number = 0; number <= testScores.size(); number++) {
+ totalScore = totalScore + testScores[number];
+ }
+
+ //print the output of testScoresSum divided by the length of testScores
+ cout << "Your average score is: " << totalScore/testScores.size() << "%\n";
+
+}
+
+
+
+
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/ExamAverage/Exam Average Program - planning sheet.docx b/C++/ExamAverage/Exam Average Program - planning sheet.docx
new file mode 100644
index 0000000..7ecf4ad
--- /dev/null
+++ b/C++/ExamAverage/Exam Average Program - planning sheet.docx
Binary files differ
diff --git a/C++/ExamAverage/Exam Average Program - planning sheet.odt b/C++/ExamAverage/Exam Average Program - planning sheet.odt
new file mode 100644
index 0000000..8e56068
--- /dev/null
+++ b/C++/ExamAverage/Exam Average Program - planning sheet.odt
Binary files differ
diff --git a/C++/ExamAverage/Exam Average Program - planning sheet.pdf b/C++/ExamAverage/Exam Average Program - planning sheet.pdf
new file mode 100644
index 0000000..cd481a2
--- /dev/null
+++ b/C++/ExamAverage/Exam Average Program - planning sheet.pdf
Binary files differ
diff --git a/C++/ExamAverage/ExamAverage.cpp b/C++/ExamAverage/ExamAverage.cpp
new file mode 100644
index 0000000..e9a6d52
--- /dev/null
+++ b/C++/ExamAverage/ExamAverage.cpp
@@ -0,0 +1,35 @@
+// Name: msglm
+// Introduction: Exam Average
+// Description: Calculates the average score between exams given exam scores.
+
+
+
+#include <iostream>
+using namespace std;
+int main() {
+ //Doubles are more percise at the cost of memory. If someone needed to optimize, here would be the area to do so.
+ double scores[5];
+ double totalScore = 0;
+
+
+ cout << "Input 5 test scores. \n";
+
+ //For 5 iterations, grab the user's input and assign it to a position in the array
+ for(int iteration = 0; iteration < 5; iteration++) {
+ cin >> scores[iteration];
+ }
+
+ //Add everything in the array together. TODO: find a better way of doing this.
+ for(int iteration = 0; iteration < 5; iteration++) {
+ totalScore = totalScore + scores[iteration];
+ }
+ //print the output of total score divided by the test score array's size (5) in this case
+ cout << "Your average score is: " << totalScore/5 << "%\n";
+}
+
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/ExamAverage2/ExamAverage2.cpp b/C++/ExamAverage2/ExamAverage2.cpp
new file mode 100644
index 0000000..d531a6b
--- /dev/null
+++ b/C++/ExamAverage2/ExamAverage2.cpp
@@ -0,0 +1,40 @@
+// Name: msglm
+// Introduction: Exam Average
+// Description: Calculates the average score between exams given exam scores.
+
+
+
+#include <iostream>
+using namespace std;
+const int NUMOFSCORES = 3;
+
+void testAverage();
+
+int main() {
+ testAverage();
+ cout << "Terminating" << endl;
+ return 0;
+}
+
+void testAverage() {
+ double avg;
+ double test1;
+ double test2;
+ double test3;
+ cout << "Enter 3 test scores. decimals are acceptable.\n";
+ cout << "Test 1\n";
+ cin >> test1;
+ cout << "Test 2\n";
+ cin >> test2;
+ cout << "Test 3\n";
+ cin >> test3;
+ avg = (test1 + test2 + test3) / NUMOFSCORES;
+ cout << "Average test score: " << avg << endl;
+}
+
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/Final Program/Final.cpp b/C++/Final Program/Final.cpp
new file mode 100644
index 0000000..10894c3
--- /dev/null
+++ b/C++/Final Program/Final.cpp
@@ -0,0 +1,247 @@
+// Name: msglm
+// Date: Nov 29th 2022
+// Program Name: Final Program
+// Description: The last hurrah!
+
+
+//This is it, the last time I will be touching C++ while not being paid!
+//But seriously, this class has been great, especially for an online class. I'm glad you were receptive to my comments and I appreciate the feedback given. The topics, while filled with gross C++isms, is useful in the industry and im glad I got to practice and refine my skills in them (even if I disliked the content).
+//For hobby projects, I'll absolutely be avoiding C++! However, this class has opened up some rabbit holes on topics to go down (such as FORTH programming and functional programming) and has let me develop my side-effect avoidant style of coding. These will surely be useful for my own hobby projects.
+//Anyway, This, and the other assignment you put out, will likely be the last you ever see from me, unless you can offer me a job or something (im graduating with my associates this semseter, so i'll consider it if you can offer!). For now at least, Goodbye and have a nice life!
+
+#include <iostream>
+#include <string>
+#include <vector>
+#include <iomanip>
+#include "person.h"
+using namespace std;
+
+//Classes
+
+class Movie : public Person {
+ private:
+ string movieName;
+ string boxOffice;
+ int year;
+ bool special;
+ public:
+ void set_movieName(string x) { movieName = x; }
+ void set_boxOffice(string x) { boxOffice = x; }
+ void set_year(int x) { year = x; }
+ string get_movieName() { return movieName; }
+ string get_boxOffice() { return boxOffice; }
+ int get_year() { return year; }
+
+ bool chosenIsFav() {
+ if (movieName == get_favmov()) {
+ return true;
+ }
+ return false;
+ }
+};
+
+string sanitize(string userInput) {
+ bool insideATag = false;
+ bool metTheTagTerminator = false;
+ int beginBracketPos;
+ int endBracketPos;
+ int tagLength;
+
+ for (int charPos=0; charPos<=userInput.length();charPos++) {
+ if (insideATag && metTheTagTerminator) {
+
+ tagLength = (endBracketPos-beginBracketPos)+1;
+ userInput.erase(beginBracketPos, tagLength);
+ charPos = 0;
+ insideATag = false;
+ metTheTagTerminator = false;
+ }
+ if (userInput[charPos] == '<') {
+ insideATag = true;
+ beginBracketPos = charPos;
+ }
+
+ if (userInput[charPos] == '>' && insideATag) {
+ metTheTagTerminator = true;
+ endBracketPos = charPos;
+ }
+
+
+ }
+ return userInput;
+}
+
+
+Movie getInput() {
+ Movie movie;
+ string temp;
+
+ cout << "===Enter your information===\n";
+ cout << "Please enter your first name: ";
+ cin >> temp;
+ movie.set_fname(sanitize(temp));
+
+ cout << "Please enter your last name: ";
+ cin >> temp;
+ cin.ignore();
+ movie.set_lname(sanitize(temp));
+
+ cout << "Please enter your favorite movie: ";
+ getline(cin, temp);
+ movie.set_favmov(sanitize(temp));
+
+ cout << "Please enter the movie's name: ";
+ getline(cin, temp);
+ movie.set_movieName(sanitize(temp));
+
+ cout << "Please enter the movie's box office: ";
+ cin >> temp;
+ movie.set_boxOffice(sanitize(temp));
+
+ cout << "Please enter the movie's year of release: ";
+ cin >> temp;
+ movie.set_year(stoi(sanitize(temp)));
+ return movie;
+}
+
+
+vector<Movie> sort(vector<Movie> movieList, int menuOption) {
+ Movie temp;
+ switch(menuOption) {
+ case 1:
+ for (int pos = 0; pos < movieList.size() - 1; pos++) {
+ for (int comparePos = 0; comparePos < ((movieList.size() - 1) - pos); comparePos++) {
+ if(movieList[comparePos].get_movieName() > movieList[comparePos + 1].get_movieName()) {
+ temp = movieList[comparePos];
+ movieList[comparePos] = movieList[comparePos + 1];
+ movieList[comparePos + 1] = temp;
+ }
+ }
+ }
+ break;
+ case 2:
+ for (int pos = 0; pos < movieList.size() - 1; pos++) {
+ for (int comparePos = 0; comparePos < ((movieList.size() - 1) - pos); comparePos++) {
+ if(movieList[comparePos].get_year() > movieList[comparePos + 2].get_year()) {
+ temp = movieList[comparePos];
+ movieList[comparePos] = movieList[comparePos + 1];
+ movieList[comparePos + 1] = temp;
+ }
+ }
+ }
+ break;
+ case 3:
+ for (int pos = 0; pos < movieList.size() - 1; pos++) {
+ for (int comparePos = 0; comparePos < ((movieList.size() - 1) - pos); comparePos++) {
+ if(stof(movieList[comparePos].get_boxOffice()) > stof(movieList[comparePos + 1].get_boxOffice())) {
+ temp = movieList[comparePos];
+ movieList[comparePos] = movieList[comparePos + 1];
+ movieList[comparePos + 1] = temp;
+ }
+ }
+ }
+ break;
+ case 4:
+ //Display the highest grossing movie's info
+ for (int pos = 0; pos < movieList.size() - 1; pos++) {
+ for (int comparePos = 0; comparePos < ((movieList.size() - 1) - pos); comparePos++) {
+ if(stof(movieList[comparePos].get_boxOffice()) > stof(movieList[comparePos + 1].get_boxOffice())) {
+ temp = movieList[comparePos];
+ movieList[comparePos] = movieList[comparePos + 1];
+ movieList[comparePos + 1] = temp;
+ }
+ }
+ }
+ movieList.erase(movieList.begin(),movieList.end()-1);
+ break;
+ case 5:
+ //Display the lowest grossing movie's info
+ for (int pos = 0; pos < movieList.size() - 1; pos++) {
+ for (int comparePos = 0; comparePos < ((movieList.size() - 1) - pos); comparePos++) {
+ if(stof(movieList[comparePos].get_boxOffice()) > stof(movieList[comparePos + 1].get_boxOffice())) {
+ temp = movieList[comparePos];
+ movieList[comparePos] = movieList[comparePos + 1];
+ movieList[comparePos + 1] = temp;
+ }
+ }
+ }
+ movieList.erase(movieList.begin()+1,movieList.end());
+ break;
+ }
+ return movieList;
+}
+
+void output(vector<Movie> movieDataContainer) {
+
+ cout << left << setw(25) << "First Name" ;
+ cout << left << setw(25) << "Last Name" ;
+ cout << left << setw(25) << "Favorite Movie" ;
+ cout << left << setw(25) << "Movie Name" ;
+ cout << left << setw(25) << "Box Office" ;
+ cout << left << setw(25) << "Year Released" ;
+
+ for (Movie movie : movieDataContainer) {
+ cout << endl;
+ cout << left << setw(25) << movie.get_fname();
+ cout << left << setw(25) << movie.get_lname();
+ cout << left << setw(25) << movie.get_favmov();
+ cout << left << setw(25) << movie.get_movieName();
+ cout << left << setw(25) << movie.get_boxOffice();
+ cout << left << setw(25) << movie.get_year();
+ if (movie.chosenIsFav()) {
+ cout << left << setw(15) << "<--- This individual's chosen movie is also their favorite!";
+ }
+ }
+ cout << endl;
+}
+
+
+int menuOption() {
+ int choice;
+ cout << "1. Sort by Movie Name\n";
+ cout << "2. Sort by Year Released\n";
+ cout << "3. Sort by Box office gross\n";
+ cout << "4. Display the highest grossing movie's info\n";
+ cout << "5. Display the lowest grossing movie's info\n";
+ cout << "Enter Selection: ";
+ cin >> choice;
+ return choice;
+}
+
+
+
+
+int main() {
+ char finished;
+ vector<Movie> movieVector;
+ movieVector.push_back(getInput());
+ movieVector.push_back(getInput());
+ movieVector.push_back(getInput());
+
+
+ //This is wrote in an uneligant way because I eliminated state when state would have been useful!
+ //Since everything is just data being passed around, there's no actual state that would tell if a user is finished or not
+ //To my knowledge, the concept of a functional Monad (https://en.wikipedia.org/wiki/Monad_(functional_programming) ) would
+ //have solved this problem, but I'm writing in C++ and not LISP, also I don't know LISP!
+ //
+ //Maybe I should learn LISP or Haskell.
+ //Wow, am I really going to be one of those functional programming nerds?
+ //I really should have gotten a math degere instead of an IT one
+ //however, the recession is looming and I need a job sooner rather than later!
+ while(true) {
+ output(sort(movieVector, menuOption()));
+ cout << "Are you finished working with your data (Y/n)?: ";
+ cin >> finished;
+ if (finished == 'y' || finished == 'Y') {
+ cout << "Acknowledged. Terminating now.\n";
+ exit(0);
+ }
+ }
+}
+/*
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License Version 3 ONLY as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
diff --git a/C++/Final Program/INSTRUCTIONS b/C++/Final Program/INSTRUCTIONS
new file mode 100644
index 0000000..277f82a
--- /dev/null
+++ b/C++/Final Program/INSTRUCTIONS
@@ -0,0 +1,50 @@
+ Final Program
+Due on Tuesday, November 29th before midnight (no late assignments accepted since this is the last day of class)
+200 Points
+Write a program that does the following:
+
+ Create a parent class called Person and it will have the variables to store first name, last name and their favorite movie
+ Move the Person class into a header file (you may keep the code together until finished, then move it to a header file to make this easier)
+ Create a child class that inherits from the Person class called Movie. It will store the variables movie name, box office gross, and year made
+ Get data via the keyboard or an input file for each of the above variables. Please store at least 3 sets of data to make the program interesting
+ As you read in the movie name, check it for <HTML> tags and remove any found
+ Create a simple menu that will ask a user if they want to:
+ Sort on the movie name
+ Sort on the box office gross
+ Sort on the year the movie was made
+ Display the highest grossing movie's info
+ Display the lowest grossing movie's info
+ The menu should loop until the user is finished making choices
+ If the person's favorite movie matches the a movie entered, output a special message to the screen
+ Output to the screen each time the user makes a selection
+
+Assignment Notes:
+
+ You are free to use arrays or vectors. Or, you can mix/match. It is up to you.
+ It will be easier if you have all of your functions in a class. This is not required though.
+ You can get the information via the keyboard or from an input file. Up to you. 
+ Your variables should be in a class - Private or Protected sections. 
+ I will be closely watching for cheating (copying from friends, online help, etc.) 
+
+General Notes:
+
+ Be sure to use comments in your program: Name, Program Description, Date and anywhere else in the program you deem necessary.
+ Much of this code came from the midterm, so you can watch the midterm key videos to see how to write a lot of this code
+ I will provide limited help in the classroom and/or email. Being a final exam, I cannot help a lot. I recommend you watch the recorded lectures on Blackboard since everything I ask you to do in this exam has examples in those lectures
+
+Grading Rubric:
+
+ If you do not include comments at the top of the program (name, program description, date), you will lose 30 points
+ If you do not use functions, then your program will not be OOP and you will get a 0/200
+ If your program is not OOP, then you will get a 0/200
+ If your program does not use inheritance, you will lose 75 points
+ If your program does not sort or sort properly, you will lose up to 60 points
+ If your program does not output a special message when a movie name matches the user's favorite movie, you will lose 20 points
+ If your program uses global variables, you will lose 10 points for each used
+ If your program does not compile (run), then I will give a grade of 0/200. But will give you the change to repair for points back (some points are better than none)
+ If your program is not formatted nicely (code all over the place, ugly), you will lose up to 50 points depending on the extent
+ If your program stops working when I run it, you will lose points. The exact amount depends on the severity of the error
+ If your program still has your friend's name on it, I will send you a message asking you to try harder while giving you a 0/200
+ If your program looks like a a professional programmer wrote it, I will write to you to ask if you want a job. Well, maybe not. But, I will ask about the code
+ This is just a list of typical issues I run into when grading to give you some idea of where your points go. Points can be taken off for other reasons. 
+
diff --git a/C++/Final Program/person.h b/C++/Final Program/person.h
new file mode 100644
index 0000000..2ec6b47
--- /dev/null
+++ b/C++/Final Program/person.h
@@ -0,0 +1,15 @@
+#include <string>
+using namespace std;
+class Person {
+ private:
+ string fname;
+ string lname;
+ string favmov;
+ public:
+ void set_fname(string x) { fname = x; }
+ void set_lname(string x) { lname = x; }
+ void set_favmov(string x) { favmov = x; }
+ string get_fname() { return fname; }
+ string get_lname() { return lname; }
+ string get_favmov() { return favmov; }
+};
diff --git a/C++/Final/Final Program Instruction (1).docx b/C++/Final/Final Program Instruction (1).docx
new file mode 100644
index 0000000..330ee70
--- /dev/null
+++ b/C++/Final/Final Program Instruction (1).docx
Binary files differ
diff --git a/C++/Final/Final Program.cpp b/C++/Final/Final Program.cpp
new file mode 100644
index 0000000..e257f12
--- /dev/null
+++ b/C++/Final/Final Program.cpp
@@ -0,0 +1,134 @@
+// Name: msglm
+// Date: 4/29/2022
+// Title: Payroll Calculator
+// Description: Takes input data from file deliminated by a space. This information is then used to calculate taxes, net, and gross pay for each person in the entry.
+
+#include <iostream>
+#include <string>
+#include <fstream>
+#include <iomanip>
+
+using namespace std;
+
+// Named constants
+int ARRAY_SIZE = 10;
+double FED_TAX=0.09;
+double STATE_TAX=0.05;
+double FICA_TAX=0.062;
+
+
+// Function prototype
+double GrossPay(double x, double y);
+double Tax(double x);
+
+// Main function--------------------------------------------------------------
+int main()
+{
+ // Declare Varibles
+ string lName[ARRAY_SIZE];
+ string fName[ARRAY_SIZE];
+ string fullName;
+ double payrate[ARRAY_SIZE];
+ double hours[ARRAY_SIZE];
+ double grossPay[ARRAY_SIZE];
+ double netPay[ARRAY_SIZE];
+ double taxesOwed[ARRAY_SIZE];
+ double totalGrossPay;
+ double totalTaxes;
+ double totalNetPay;
+
+ // Declare variables for files
+ ifstream inputFile;
+ ofstream outputFile;
+
+ // Open files
+ inputFile.open("hourlyinput.txt");
+ outputFile.open("hourlyoutput.txt");
+
+
+
+
+ // Print grogram title and description
+ cout << "Title: Payroll Calculator" << endl << "Description: Takes input data from file deliminated by a space. This information is then used to calculate taxes, net, and gross pay for each person in the entry." << endl;
+
+
+ // check to make sure input file opened
+ if (inputFile) {
+ cout << "Successfully opened file";
+ } else {
+ cout << "ERROR! File failed to open!";
+ return 1;
+ }
+
+ // Collect data from the file (Parallel Arrays)
+
+ for (int i = 0; i < ARRAY_SIZE; i++) {
+ inputFile >> fName[i] >> lName[i] >> payrate[i] >> hours[i];
+
+
+ // Calculate Gross pay for all employees and store in arrays
+ grossPay[i] = GrossPay(hours[i], payrate[i]);
+
+
+ // Calculate taxes for all employees and store in arrays
+
+ taxesOwed[i] = Tax(grossPay[i]);
+
+
+
+ // Calculate net pay for each employee and store in arrays
+
+ netPay[i] = grossPay[i] - taxesOwed[i];
+ }
+
+ // Printing payroll report to an OUTPUT FILE
+
+ outputFile << fixed << left << showpoint << setprecision(2);
+ outputFile << setw(17) << "Name" << setw(13) << "Payrate" << setw(9) << "Hours" << setw(9) << "Gross" << setw(9) << "Taxes" << setw(9) << "Net" << endl;
+ for (int i = 0; i < ARRAY_SIZE; i++) {
+ fullName = fName[i] + " " + lName[i];
+ outputFile << setw(17) << fullName << setw(13) << payrate[i] << setw(9) << hours[i] << setw(9) << grossPay[i] << setw(9) << taxesOwed[i] << setw(9) << netPay[i] << endl;
+ }
+
+ cout << "Outputted to file.";
+
+ // Print payroll statistics to the SCREEN
+
+ for (int i = 0; i < ARRAY_SIZE; i++)
+ {
+ totalGrossPay = totalGrossPay + grossPay[i];
+ totalTaxes = totalTaxes + taxesOwed[i];
+ totalNetPay = totalNetPay + netPay[i];
+ }
+ cout << "Weekly Payroll Statistics:\n\n" ;
+ cout << "Total Gross Pay: " << totalGrossPay << endl;
+ cout << "Total Taxes: " << totalTaxes << endl;
+ cout << "Total Net Pay: " << totalNetPay << endl;
+
+
+
+ // Close files
+ outputFile.close();
+ inputFile.close();
+
+
+ return 0;
+}
+
+// Function definations
+
+double GrossPay(double payRateValue, double hours)
+{
+
+return payRateValue*hours;
+
+}
+
+double Tax(double grossPayValue)
+{
+ double FICAOwed = grossPayValue * FICA_TAX;
+ double stateOwed = grossPayValue * STATE_TAX;
+ double fedOwed = grossPayValue * FED_TAX;
+ double totalTax = FICAOwed + stateOwed + fedOwed;
+ return totalTax;
+}
diff --git a/C++/Final/Final Project Grade Sheet .pdf b/C++/Final/Final Project Grade Sheet .pdf
new file mode 100644
index 0000000..e7227f4
--- /dev/null
+++ b/C++/Final/Final Project Grade Sheet .pdf
Binary files differ
diff --git a/C++/Final/hourlyinput.txt b/C++/Final/hourlyinput.txt
new file mode 100644
index 0000000..cad5cdf
--- /dev/null
+++ b/C++/Final/hourlyinput.txt
@@ -0,0 +1,10 @@
+Anders Alex 13.25 37.5
+Botch Beth 11.25 35.5
+Cross Brian 14.50 38
+Doe John 15.75 35
+Eyre Jane 20.00 40
+Falls Frank 18.50 39
+Gall George 17.00 25
+Hicks Heath 13.75 38
+Jacob John 15.50 33
+Ihle Ike 16.50 37 \ No newline at end of file
diff --git a/C++/Final/hourlyoutput.txt b/C++/Final/hourlyoutput.txt
new file mode 100644
index 0000000..491e315
--- /dev/null
+++ b/C++/Final/hourlyoutput.txt
@@ -0,0 +1,11 @@
+Name Payrate Hours Gross Taxes Net
+Anders Alex 13.25 37.50 496.88 100.37 396.51
+Botch Beth 11.25 35.50 399.38 80.67 318.70
+Cross Brian 14.50 38.00 551.00 111.30 439.70
+Doe John 15.75 35.00 551.25 111.35 439.90
+Eyre Jane 20.00 40.00 800.00 161.60 638.40
+Falls Frank 18.50 39.00 721.50 145.74 575.76
+Gall George 17.00 25.00 425.00 85.85 339.15
+Hicks Heath 13.75 38.00 522.50 105.55 416.95
+Jacob John 15.50 33.00 511.50 103.32 408.18
+Ihle Ike 16.50 37.00 610.50 123.32 487.18
diff --git a/C++/FindLargestNumber/FindLargestNumber.cpp b/C++/FindLargestNumber/FindLargestNumber.cpp
new file mode 100644
index 0000000..e03f5ac
--- /dev/null
+++ b/C++/FindLargestNumber/FindLargestNumber.cpp
@@ -0,0 +1,39 @@
+#include <iostream>
+using namespace std;
+
+//Function decleration/prototype
+//Functions are created in order from top to bottom
+double larger(double x, double y);
+double threelarger(double x, double y, double z);
+
+int main() {
+ double num1, num2, num3;
+ cout << "find the largest of two numbers \n\n";
+ cout << "enter number 1: ";
+ cin >> num1;
+ cout << "enter number 2: ";
+ cin >> num2;
+ cout << "enter number 2: ";
+ cin >> num3;
+
+ answer = threelarger(num1, num2, num3);
+
+ cout << "the largest of the three numbers you entered is: " << larger(num1,num2) << endl;
+
+}
+
+double threelarger (double x, double y) {
+ double max;
+
+ if (x > y) {
+ max = x;
+ } else {
+ max = y;
+ }
+
+ return max;
+}
+
+double larger (double x, double y) {
+ return larger(x, larger(y,z));
+}
diff --git a/C++/ForLoopPractice/ForLoopPractice.cpp b/C++/ForLoopPractice/ForLoopPractice.cpp
new file mode 100644
index 0000000..d5b344f
--- /dev/null
+++ b/C++/ForLoopPractice/ForLoopPractice.cpp
@@ -0,0 +1,44 @@
+// Name: msglm
+// Date:
+// Program Name:
+// Description:
+
+
+#include <iostream>
+#include <string>
+#include <iomanip>
+using namespace std;
+
+int main() {
+ int i;
+ //Example 1
+ cout << "Example 1";
+ for(i=1; i<=3;i++){
+ cout << "Hello!" << endl;
+ cout << "*" << endl;
+ }
+ //Example 2
+ int num;
+ string name;
+ cout << "Out of loop";
+ cout << "What is your first name? ";
+ cin >> name;
+ cout << "How many times would you like your name printed?: ";
+ cin >> num;
+ for(i=1;i <= num;i++){
+ cout << name << endl;
+ }
+
+ //Example 3
+ for(i=0;i<=10;i=i+2){
+ cout << i << " ";
+ }
+ return 0;
+}
+
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/GuessingGame/Guessing Game Program Instructions.docx b/C++/GuessingGame/Guessing Game Program Instructions.docx
new file mode 100644
index 0000000..798663c
--- /dev/null
+++ b/C++/GuessingGame/Guessing Game Program Instructions.docx
Binary files differ
diff --git a/C++/GuessingGame/GuessingGame.cpp b/C++/GuessingGame/GuessingGame.cpp
new file mode 100644
index 0000000..c1e1754
--- /dev/null
+++ b/C++/GuessingGame/GuessingGame.cpp
@@ -0,0 +1,89 @@
+// Name: msglm
+// Date:
+// Program Name:
+// Description:
+
+#include <cstdlib>
+#include <iostream>
+#include <string>
+#include <iomanip>
+#include <ctime>
+
+using namespace std;
+
+// Named constants
+
+int main() {
+
+ //Variable declaration
+ int tries;
+ int correctNum;
+ int userInput;
+ bool invalidInput = 0;
+ //Randomness
+ srand(time(0));
+ correctNum = rand() % 100;
+
+ //Program title and description for the user
+ cout << "Title: Guessing game" << endl << "Description: Makes the player choose a number between 1 and 100" << endl;
+
+ // User input
+ do {
+
+ do {
+ if (invalidInput) {
+ //Clear the input if what was inputted was non-standard
+ cin.clear();
+ cin.ignore(100,'\n');
+ invalidInput = 0;
+ }
+
+ //User instruction and input
+ cout << "You have " << 10-tries << " number of tries left\n";
+ cout << "Guess a number between 1 and 100 (inclusive): \n";
+ cin >> userInput;
+
+ //Make sure input is valid
+ //Reason to declare a bool for this is so that
+ //invalid input doesn't count as a "try"
+ //Without this, either the player would have to input the first number twice
+ //or the player would waste a try for a misclick
+ if (!cin || userInput > 100 || userInput < 0) {
+ invalidInput = 1;
+ }
+
+
+
+ } while (!cin || userInput > 100 || userInput < 0); //If input was bad, loop over to allow it to be checked, cleared, and ignored
+
+
+ //Detection if how high or low the numbers are
+ if (userInput > correctNum) {
+ cout << "The correct number is lower than your input\n\n";
+ } else if (userInput < correctNum) {
+ cout << "The correct number is higher than your input\n\n";
+ } else {
+ cout << "You succeeded!\n";
+ return 0;
+ //Exit program upon success
+ //I prefer not to have my cli programs ask to loop
+ //If I wish to play again, I will merely run the program again.
+ //Also it was not in the instructions
+ }
+ tries++;
+ } while (tries < 10);
+ //Fail condition
+ //Return code of 1 so that shell scripting can be aware if player failed the game
+ //maybe someone would write a tournament script for this?
+ //Unlikely, but possible.
+ cout << "You ran out of tries, you failed!\n";
+ cout << "The number was: " << correctNum << endl;
+ return 1;
+}
+
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/HelloWorld/HelloWorld b/C++/HelloWorld/HelloWorld
new file mode 100755
index 0000000..29f120d
--- /dev/null
+++ b/C++/HelloWorld/HelloWorld
Binary files differ
diff --git a/C++/HelloWorld/HelloWorld.cpp b/C++/HelloWorld/HelloWorld.cpp
new file mode 100644
index 0000000..2b0af1e
--- /dev/null
+++ b/C++/HelloWorld/HelloWorld.cpp
@@ -0,0 +1,6 @@
+#include <iostream>
+int main() {
+
+ std::cout << "Hello World!\nMy name is Anonymous\n";
+ return 0;
+}
diff --git a/C++/Inheritance/INSTRUCTIONS b/C++/Inheritance/INSTRUCTIONS
new file mode 100644
index 0000000..8dfab17
--- /dev/null
+++ b/C++/Inheritance/INSTRUCTIONS
@@ -0,0 +1,35 @@
+
+Project 8: Inheritance
+Due: Monday, October 31st, 2022 before midnight
+100 Points
+Write a program that does the following:
+1. Make a parent class called person with the following variables: first name, last name, street address, city, state, zip, phone number
+2. Make a child class called student that inherits from person. This class will have the following variables: GPA, major, credit hours, anticipated year of graduation
+3. Move the parent class to a header file and include it into your main program
+4. Get data for all of the above variables (keyboard or input file. Your choice)
+5. When the user is finished updating information, output everything to the screen
+Assignment Notes:
+
+ Make variables either arrays or vectors - your choice
+ I expect to see functions throughout this program
+
+General Notes:
+Be sure to use comments in your program: Name, Program Description, Date and anywhere else in the program you deem necessary.
+If you are stuck, I will help you!
+Grading Rubric:
+
+ If you do not include comments at the top of the program (name, program description, date), you will lose 15 points
+ If your program is not object-oriented, you will receive a 0/100 (OOP is requred for this assignment)
+ If your program does not use functions, you will lose up to 75 points (depending on the number of functions missing)
+ If your program does not compile (run), then I will give a grade of 0/100. But will give you the change to repair for points back (some points are better than none)
+ If your program is late (within 48 hours of the due date), you will lose 25 points
+ If your program is late beyond the 48 hour due date, I will typically still accept it, but you will lose far more points. Depends on when you turn it in
+ If you use global variables in your program, I will deduct 5 points for each used
+ If your program is not formatted nicely (code all over the place, ugly), you will lose up to 25 points depending on the extent
+ If your program stops working when I run it, you will lose points. The exact amount depends on the severity of the error
+ If your program still has your friend's name on it, I will send you a message asking you to try harder while giving you a 0/100
+ If you submit a file type I cannot open, such as .sln, you will receive a 0/100. You will be able to resubmit for credit, but you will lose up to 90 points (depending on how late it is)
+ If your program looks like a a professional programmer wrote it, I will write to you to ask if you want a job. Well, maybe not. But, I will ask about the code
+ This is just a list of typical issues I run into when grading to give you some idea of where your points go. Points can be taken off for other reasons.
+
+
diff --git a/C++/Inheritance/Inheritance.cpp b/C++/Inheritance/Inheritance.cpp
new file mode 100644
index 0000000..3d022b4
--- /dev/null
+++ b/C++/Inheritance/Inheritance.cpp
@@ -0,0 +1,102 @@
+// Name: msglm
+// Date: Oct-31st-2022
+// Program Name: Inheritance
+// Description: Inheritance practice
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include "person.h"
+using namespace std;
+
+
+//Classes
+//I love it when my "cat" object can do my taxes because some incompetent intern in upstream decided to
+//that the great-great-great-great-great-great-grandparent "basic" object needs that functionality
+//
+//I also love it when i'm programming and everything must be an object, thus making me have to inherit from 40 million parents who supply their own
+//lovely genetic debt and confusion, just to do something simple (Godot and Java both do this and it makes me rage).
+//
+//OOP is one of those things that's entire purpose, code reuse, is annhiliated by itself once you try to use it and can be replaced by tech we had before. Any time I have the dismay of using an OOPy system, I have to reimplement half the things offered with my own implementations because the junk that's offered is burried under so much inherited cruft that it's outright impossible to use them without breaking a couple keyboards.
+//Code reuse is also misnomer, people really mean "functionality reuse", which can be achieved with a mix of good data structure design and subroutines, tech that has existed since the days of the ENIAC (and theoretically from the days of Turing).
+//
+//Inheritance alone makes using GOTO calls feel like some revolutionary technology that made the lives of all developers easier.
+class student: public person {
+ public:
+ float GPA;
+ string major;
+ int hours;
+ int yearOfGrad;
+};
+
+
+//Takes in the initalized file and puts it into an object instance
+student getStudent() {
+ student student;
+ string temp;
+
+ cout << "===Enter your information===\n";
+ cout << "Please enter your first name: ";
+ cin >> temp;
+ student.fname = temp;
+ cout << "Please enter your last name: ";
+ cin >> temp;
+ student.lname = temp;
+ cout << "Please enter your address: ";
+ cin >> temp;
+ student.address = temp;
+ cout << "Please enter your city: ";
+ cin >> temp;
+ student.city = temp;
+ cout << "Please enter your state: ";
+ cin >> temp;
+ student.state = temp;
+ cout << "Please enter your major: ";
+ cin >> temp;
+ student.major = temp;
+ cout << "Please enter your zip code: ";
+ cin >> temp;
+ student.zip = stoi(temp);
+ cout << "Please enter your phone number: ";
+ cin >> temp;
+ student.phonenum = stoi(temp);
+ cout << "Please enter your GPA: ";
+ cin >> temp;
+ student.GPA = stoi(temp);
+ cout << "Please enter your hours: ";
+ cin >> temp;
+ student.hours = stoi(temp);
+ cout << "Please enter your year of graduation: ";
+ cin >> temp;
+ student.yearOfGrad = stoi(temp);
+ return student;
+}
+
+void out(student student) {
+ cout << "fname: " << student.fname << endl;
+ cout << "lname: " << student.lname << endl;
+ cout << "address: " << student.address << endl;
+ cout << "city: " << student.city << endl;
+ cout << "state: " << student.state << endl;
+ cout << "zip: " << student.zip << endl;
+ cout << "phonenum: " << student.phonenum << endl;
+ cout << "GPA: " << student.GPA << endl;
+ cout << "major: " << student.major << endl;
+ cout << "hours: " << student.hours << endl;
+ cout << "yearOfGrad: " << student.yearOfGrad << endl;
+
+}
+
+
+int main() {
+
+ out(getStudent());
+}
+
+/*
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License Version 3 ONLY as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
diff --git a/C++/Inheritance/person.h b/C++/Inheritance/person.h
new file mode 100644
index 0000000..a9fca01
--- /dev/null
+++ b/C++/Inheritance/person.h
@@ -0,0 +1,12 @@
+#include <string>
+using namespace std;
+class person {
+ public:
+ string fname;
+ string lname;
+ string address;
+ string city;
+ string state;
+ int zip;
+ int phonenum;
+};
diff --git a/C++/Intro to Object-Oriented Programming/WhatIsOOP.docx b/C++/Intro to Object-Oriented Programming/WhatIsOOP.docx
new file mode 100644
index 0000000..8ef696e
--- /dev/null
+++ b/C++/Intro to Object-Oriented Programming/WhatIsOOP.docx
Binary files differ
diff --git a/C++/Introduction/Introduction.cpp b/C++/Introduction/Introduction.cpp
new file mode 100644
index 0000000..d1e4013
--- /dev/null
+++ b/C++/Introduction/Introduction.cpp
@@ -0,0 +1,26 @@
+// Name: msglm
+// Introduction:
+// Description: Each student will type at least 4 lines to introduce himself.
+
+
+#include <iostream>
+using namespace std;
+int main() {
+
+ cout << "My Name is Anonymous.\n";
+ cout << "I am a supporter of the Free Software Movement.\n";
+ cout << "I usually code in Python, but C++ is something I've been meaning to learn\n";
+ cout << "This is my third programming class I've taken.\n";
+
+ //printf is more readable in most cases and flows better than than a UNIX redirection based object like cout
+ //printf("My Name is Anonymous\n")
+ //As C++ borrows plenty of C, these C commands will compile too.
+ return 0;
+}
+
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/LengthInFeetPlusInchesRemainder/LengthInFeetPlusInchesRemainder.cpp b/C++/LengthInFeetPlusInchesRemainder/LengthInFeetPlusInchesRemainder.cpp
new file mode 100644
index 0000000..bc95a35
--- /dev/null
+++ b/C++/LengthInFeetPlusInchesRemainder/LengthInFeetPlusInchesRemainder.cpp
@@ -0,0 +1,19 @@
+// Given length in inches, this program outputs the equivalent
+// length in feet and remaining inch(es).
+#include <iostream>
+using namespace std;
+int main() {
+int inches; //variable to store total inches
+
+cout << "Enter inches and press Enter: ";
+cin >> inches;
+cout << endl;
+
+cout << inches << " inch(es) = "; //output the value of
+//inches and the equal sign
+cout << inches / 12 << " feet (foot) and "; //output maximum
+//number of feet (foot)
+cout << inches % 12 << " inch(es)" << endl; //output
+//remaining inches
+return 0;
+}
diff --git a/C++/Menu System/Instruction b/C++/Menu System/Instruction
new file mode 100644
index 0000000..a8ccdc6
--- /dev/null
+++ b/C++/Menu System/Instruction
@@ -0,0 +1,51 @@
+Using the attached video as a guide, you will create a menu system that will mimic a self service kiosk at a restaurant. This program will do the following:
+
+ Create a menu system that allows users to select an item from the below categories:
+ Drink
+ Appetizer
+ Entree
+ Dessert
+ You will use 4 separate input files (one for each category above) where you read in an unknown number of items from each file
+ Each input file will have the item name (string) and the item price (double)
+ Use a generic function to check to see if the file was found
+ User a generic function to get the data from each of the input files
+ Display the subtotal on each menu screen so the customer knows exactly how much is already owed
+ As the customer selects items for purchase, you will need to record the item name, price and the quantity desired inside of variables (vector or array) for output later
+ The customer should be able to remain in a category menu until they are ready to return to the main menu
+ When the customer is finished ordering, display the subtotal, tax, and total on the screen
+ Ask for a tip (make a suggested tip amount with 18%, 20%, 25%), then update the total with the tip amount entered
+ Get payment from the user and display change due to the customer
+ If the customer does not pay enough money, then the program should continue to ask for money until the total is paid in full
+
+Assignment Notes:
+
+ Make your all of variables as private in the class to show me you understand how to do this
+ You may use vectors or array variables to store the employee data
+ Use a 10% tax rate to make the math easy
+ You may use functions inside of the class or outside or mixed. Your choice
+ Be sure to add in error checking in case someone enters a value that will break your program! Example: Tip is -1000 which means your system would pay the customer!
+ I expect to see functions, but I am not giving you a specific number. You should be able to determine this by yourself by now
+
+General Notes:
+Be sure to use comments in your program: Name, Program Description, Date and anywhere else in the program you deem necessary.
+If you are stuck, I will help you!
+Grading Rubric:
+
+ If you do not include comments at the top of the program (name, program description, date), you will lose 15 points
+ If your program is not object-oriented, you will lose up to 100 points (OOP is the goal of this assignment)
+ If your program has no error checking, as mentioned above, you will lose up to 25 points
+ If your program does not stay in a category menu until the customer wants to leave, you will lose 10 points
+ If you do not use generic functions for checking to see if the file is open or for reading in the data from input files, you will lose up to 40 points
+ If your program does not loop from insufficient payment, you will lose up to 25 points
+ If your program does not use functions, you will lose up to 50 points
+ If your program does not compile (run), then I will give a grade of 0/100. But will give you the change to repair for points back (some points are better than none)
+ If your program is late (within 48 hours of the due date), you will lose 25 points
+ If your program is late beyond the 48 hour due date, I will typically still accept it, but you will lose far more points. Depends on when you turn it in
+ If you use global variables in your program, I will deduct 5 points for each used
+ If your program is not formatted nicely (code all over the place, ugly), you will lose up to 25 points depending on the extent
+ If your program stops working when I run it, you will lose points. The exact amount depends on the severity of the error
+ If your program still has your friend's name on it, I will send you a message asking you to try harder while giving you a 0/100
+ If your program looks like a a professional programmer wrote it, I will write to you to ask if you want a job. Well, maybe not. But, I will ask about the code
+ This is just a list of typical issues I run into when grading to give you some idea of where your points go. Points can be taken off for other reasons.
+
+
diff --git a/C++/Menu System/MenuSystem.cpp b/C++/Menu System/MenuSystem.cpp
new file mode 100644
index 0000000..20226a4
--- /dev/null
+++ b/C++/Menu System/MenuSystem.cpp
@@ -0,0 +1,255 @@
+// Name: msglm
+// Date: Oct 21st, 2022
+// Program Name: Menu System
+// Description: CLI, self-servicing kiosk
+
+#include <iostream>
+#include <fstream>
+#include <vector>
+#include <string>
+using namespace std;
+
+//Classes
+
+//I would never, ever make this an object in production
+//the concept of an "Orderable" is pure data read from a file that should be acted upon, but not act.
+class Orderable {
+ private:
+ string name;
+ double price;
+ public:
+ Orderable(double iprice, string iname) {
+ name = iname;
+ price = iprice;
+ }
+
+ string get_name() {return name;}
+ double get_price() {return price;}
+};
+
+
+//Structs
+struct foodOrder {
+ string name;
+ double price;
+ int quantity;
+};
+
+//Implementation of Nim's readline (https://nim-lang.org/docs/io.html#readLine%2CFile) because
+//I am absolutely sick of having to deal with C++'s obsession with streaming.
+//
+//I swear if I have to reimplement the entire Nim language in C++20 just
+//to get a compiled language that doesn't increase my chance of stroke 20 fold I will
+
+string readline(ifstream & fileVar) {
+ string temp;
+ getline(fileVar, temp);
+ return temp;
+}
+
+
+void initalize(string location, ifstream & fileVar) {
+ fileVar.open(location);
+
+ if (!fileVar) {
+ cout << "ERROR! " << location << " failed to open!";
+ exit(1);
+ }
+}
+
+
+//Ideally, the input file should be JSON, YAML, or TOML based
+//instead of pure plain text for ease of human access
+//but C++ doesn't have JSON parsing library in std for some reason
+vector<Orderable> encodeOrderables(ifstream & fileVar) {
+ string temp;
+ vector<Orderable> orderablesFromFile;
+ while(fileVar.peek() != EOF) {
+ //Here's something absolutely nasty that I discovered while working on this:
+ //when attempting to write the line
+ //orderablesFromFile.push_back(Orderable(readline(fileVar)), stod(readline(fileVar)));
+ //with the object's constructor taking the name then price parameter, I found out that
+ //constructors are executed from right-to-left, not left-to-right and the price would be
+ //read first rather than the name.
+ //
+ //This might be the case for all functions, I did not check.
+ //
+ //There is literally no good reason for this to be the case.
+ orderablesFromFile.push_back(Orderable(stod(readline(fileVar)), readline(fileVar)));
+ }
+ return orderablesFromFile;
+}
+
+//Menu systems
+//Wish we could do some ncurses TUI menus, but alas we're stuck with subpar prompts
+
+int catagoryMenu() {
+ int choice;
+ //No input validation here since the rubric doesn't call for it.
+ cout << "Pick a catagory\n";
+ cout << "1. Drink\n";
+ cout << "2. Appetizer\n";
+ cout << "3. Entree\n";
+ cout << "4. Dessert\n";
+ cout << "5. Finish Order\n";
+ cout << "Enter Selection: ";
+ cin >> choice;
+ return choice;
+}
+
+foodOrder orderingMenu(vector<Orderable> items) {
+ foodOrder completeOrder;
+ int choice;
+ for(int itemPos = 0; itemPos < items.size(); itemPos++) {
+ cout << itemPos << ". " << items[itemPos].get_name() << " - $" << items[itemPos].get_price() << endl;
+ }
+ cout << "Enter Selection: ";
+ cin >> choice;
+ cout << "Enter Amount Desired: ";
+ cin >> completeOrder.quantity;
+
+ completeOrder.name = items[choice].get_name();
+ completeOrder.price = items[choice].get_price();
+
+ //"...you will need to record the item name, price and the quantity desired inside of variables (vector or array) for output later..."
+ //I am modifying this instruction a bit to use a struct instead since structs can hold multiple datatypes and play nice with functions
+ return completeOrder;
+}
+
+//Who can afford to pay this much when tipping?
+//I can barely afford car insurance!
+double tip() {
+ int choice;
+ //No input validation here since the rubric doesn't call for it.
+ cout << "What percent would you like to tip?\n";
+ cout << "1. 18%\n";
+ cout << "2. 20%.\n";
+ cout << "3. 25%.\n";
+ cout << "4. Custom Amount.\n";
+ cin >> choice;
+ switch(choice) {
+ case 1:
+ return 0.18;
+ break;
+ case 2:
+ return 0.20;
+ break;
+ case 3:
+ return 0.25;
+ break;
+ case 4:
+ double tip;
+ cout << "Enter a tip amount (decimal notation) [ex: 0.18]: ";
+ cin >> tip;
+ //Evil solution to evil users
+ return abs(tip);
+ break;
+ default:
+ cout << "ERROR: Your input was invalid, terminating";
+ exit(1);
+
+ }
+ return choice;
+
+}
+
+double figureTotal(vector<foodOrder> orderList) {
+ double subtotal;
+ for(int orderPos = 0; orderPos < orderList.size(); orderPos++) {
+ subtotal = subtotal + orderList[orderPos].price;
+ }
+ double tax = subtotal*0.1;
+ double total = subtotal+tax;
+
+ //tips
+ cout << "===Amount Currently Due==\n";
+ cout << "Subtotal: $" << subtotal << endl;
+ cout << "Tax: $" << tax << endl;
+ cout << "Total: $" << total << endl;
+ cout << "=========================\n";
+
+
+ total = total + (total*tip());
+
+ cout << "\033[2J\033[1;1H";
+
+ cout << "===Amount Currently Due==\n";
+ cout << "Subtotal: $" << subtotal << endl;
+ cout << "Tax: $" << tax << endl;
+ cout << "Total: $" << total << endl;
+
+ return total;
+}
+
+void collectDues(double amountDue) {
+ double paid;
+ while (amountDue > 0) {
+ cout << "Please pay for the amount owed: $" << amountDue << endl;
+ cout << "Enter payment: ";
+ cin >> paid;
+ amountDue = amountDue - paid;
+ paid = 0;
+ }
+}
+
+int main() {
+ //File Vars & Inits
+ ifstream drinkFile;
+ ifstream appetizerFile;
+ ifstream entreeFile;
+ ifstream dessertFile;
+
+ initalize("drink.txt", drinkFile);
+ initalize("appetizer.txt", appetizerFile);
+ initalize("entree.txt", entreeFile);
+ initalize("dessert.txt", dessertFile);
+
+ //Ordering Vars
+ vector<Orderable> possibleDrinks = encodeOrderables(drinkFile);
+ vector<Orderable> possibleAppetizer = encodeOrderables(appetizerFile);
+ vector<Orderable> possibleEntree = encodeOrderables(entreeFile);
+ vector<Orderable> possibleDessert = encodeOrderables(dessertFile);
+
+ vector<foodOrder> userOrderList;
+ bool ordering = true;
+
+ //"The customer should be able to remain in a category menu until they are ready to return to the main menu"
+ //I assume this means that the customer should be allows to keep ordering until they're satisfied
+ while(ordering) {
+ switch(catagoryMenu()) {
+ case 1:
+ userOrderList.push_back(orderingMenu(possibleDrinks));
+ break;
+ case 2:
+ userOrderList.push_back(orderingMenu(possibleAppetizer));
+ break;
+ case 3:
+ userOrderList.push_back(orderingMenu(possibleEntree));
+ break;
+ case 4:
+ userOrderList.push_back(orderingMenu(possibleDessert));
+ break;
+ case 5:
+ ordering = false;
+ break;
+ default:
+ cout << "ERROR: Your input was invalid, terminating";
+ exit(1);
+ }
+
+ }
+ collectDues(figureTotal(userOrderList));
+ //When the customer is finished ordering, display the subtotal, tax, and total on the screen
+ //Ask for a tip (make a suggested tip amount with 18%, 20%, 25%), then update the total with the tip amount entered
+ //Get payment from the user and display change due to the customer
+ //If the customer does not pay enough money, then the program should continue to ask for money until the total is paid in full
+
+}
+
+/*
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License Version 3 ONLY as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
diff --git a/C++/Menu System/appetizer.txt b/C++/Menu System/appetizer.txt
new file mode 100644
index 0000000..0c7579b
--- /dev/null
+++ b/C++/Menu System/appetizer.txt
@@ -0,0 +1,52 @@
+8c049f21d1fb66c4e7e5c22fdf0576954e240a3f6770839105758757dc9be9c180e9d53cf77cff05317590c6ebfc2719e1cd1200ff2083d3db14e198022127a0
+11.0
+9c7fcc22dfc7635140833620ace709fac99eed727f4d0440b041b42cc1b4d51bcac0a17c9a254c9da85cfc520e3593785daeaa42169d5230fdfe8b4685ea3d62
+11.1
+a8fda638e15580587f2206d170e87feef10d89ec61269bef803bfedb41226a52ce5e27f267d3e9bb764ae4dd209308000ed56cf1e8e4e4d722113baba81eca84
+11.2
+775ec870a730d4b609121e8d65ea9c1b6c9a7fd6976abb7400ea17988bb33f43f3ecb9b4d98b4e1bc910548acc6559e0883abafe21d7c5d193f80292bdee92d4
+11.3
+276985351c53204df2f86bf8f8d1a2911b47131385e0edc65f49dccacaa1fec8c865d4f4f6bbd93b9e64b402e112491451010fa6973e7f43e3826e5feccc876e
+11.4
+e190395a2149615ea6055ecb33c68a0caf2aea4fe3e168b102258ed51e65c942de0042ec412812749a58b2d8b1892b33219ded8d59556b9387f0ac6ae18165c0
+11.5
+2897520db910c59b0a70cd05e2711343abb3a98e33220bc9149caac52ff32a1762b99b1b00dce9811ddfc409d4b1528b8a0d8796c7a2a01726a3350ce28c2f5d
+11.6
+f77f49c403586e6d18e6b8393469b757a7388331c9cf3e145c067ae1b7591ff9262fe7293299acb667864937a092f8ab3a55b74cd4d41f1b1ec07bf9edf13f4e
+11.7
+99d1bcb6d2d76d89b81fd8b321c2e1e3953e2d5feaf1792ef81a66420e70494ea5a4ea1680500cfdaa64e939d169c9ceb5d91fba3083589791864f24d4d6f095
+11.8
+50c68990cbe6cdc21e710481aa1ce96357a71f92ba17c35bf4f70a3598aaf19b1b98db85891f17d74b5d63531edacf416d85738d6842ffa6697077665e4a882d
+11.9
+af5d3e5dc0752cf01cb6fc6f073e5986a148ba000cc79c181a8ee11ffb99ea4f9441ba7bb09f5c0e91a8258ad32df3903bbb2b337193e63de247487eb361b598
+11.10
+9b30d97a741781d3f28ffe1509813d79031a2bcf401fce8c019e5ec39eb2305feab41de522f06b1aeff277469d8a93a6e79e60e631dc33b7d3d49ad7fce8cde0
+11.11
+b95f4f4dd09ffedd79dfa8f0386b1b5afe259e1a2516818037139b01d15ca0b37c4c2e265c0ea7325de0de721a3d93ca3b172092fea405f7c2a7b9fb99b70373
+11.12
+2c0c8c8f16ea92ab5115e9ee0e21ab374059b40184072840244a42a9875ea0e212449ed35512c07faa0e3c205b25e901792f0e297ebbeffa07d4fcc2e17a26f1
+11.13
+1693718742c8beadbdca58455402802fdccb0357ad0880cd3322ede3782746a99fa203c67a8b3f8326c02e6091066b23e4f3061a05facbf265cd340452610f8b
+11.14
+1d8c7356bce55e05a2b1abc3f7820f4d7e7eac1a27df54385f029f17b91a73bdd86fb869fd02beaf7a647e714ad6e6db5913db170535a87460ede6af61c45883
+11.15
+fe2843d1639eb7a88e88b223d31f155ad36226707988b87c82add9ea2028b4897fa4b2cdfddb249375b316c25f78323c3b771529295b95c8a1acb40208e3c861
+11.16
+a35e931885d81c913799133a0140466229db2c86b2d27a567e0e54310be57b5152993afd9f7a8d6d3d9102a6d2d0ad1725446296991c573cded4d8e4cc6406f4
+11.17
+ef27dd3fde5037cc6240856d03b42ba93b3d9691cf3bb4cc3ccf21b6515fde6cde7866f4f568a972cbe485e1951ff7cec05463b923b1c2e35a5397137d82acdb
+11.18
+98d5887c2d5951ac417443462f9e00c0b0e078dd2686c37f91db912a19005c149fb15b1c6b70e96d8184c64dc2e014fa2dfbc4cce7d300519cb14678b5a20923
+11.19
+195360645b6f50ac065acb16c33e9a457c08bb667d6782d10c4f0b0754266059aac960c53262c90d4ebba96f551953116f3c5ea564a389ce55be2a4f9d7fba55
+11.20
+d5bb16c1b6e0436b37db7da2d392613a85b81bad02b00ab638e23729c17756eda0ef8f4320d269b5a048d0d47703375533a402a0ac4934c28b687440b85a3fdd
+11.21
+2743af3b8492463552a5ed72d41b49a08a47409d467451408f2ba9cc4ab6f1aac30d01d103631f6bbd01742753e7b29093c94552936ccfdb1a2beb4ae2a637ba
+11.22
+087515ce96a18b66a4d962a4b6728b7ed9133a60b57096df97ef845f24b373f0af7c4542171061abff4991ddf4b64f6baf9a6eba73ab10106f27c4a30ec91462
+11.23
+636c187d435a8ea2cb6b4685e841ccf23eee0eb0c7d77e36c78cdbdc16d17639368b445f4d9e25eadd142fdfd8f5747a5c1db225a00ae4f5fb2139aaeeb69b7b
+11.24
+dfb78750a9bdc7eb1f7700d604542205f6d216a52a30e160679e2f5fd6963acc49520c1e94bc42c57cd7372c7a898b47b9419b9afa4aa6bf96ee9804e2b24289
+11.25
diff --git a/C++/Menu System/dessert.txt b/C++/Menu System/dessert.txt
new file mode 100644
index 0000000..4f2a81c
--- /dev/null
+++ b/C++/Menu System/dessert.txt
@@ -0,0 +1,52 @@
+961a4c6cfe00b9543dc95496bc956bcf112f9457c62195cc8cff2ecabfc72747f02df0f4589b154f5c6a1a1121d698adab39540d29dea07c52177219b904662f
+11.0
+413c3158bc233d6cc604b57fb613218c99649fe8461d1e22d732e430e22bac62d334c55c09272b621f2f554026ad94938292cfd7b67e0fabf022621d0d4c6b7c
+11.1
+b745e9ac1352c092fb1c0cfa34d657a99aee6bd20c87cb51d69d16e68e1723c9590188b692a89f3403505321c89c89492c70bfe9790fcd766ec2602d656fa9b5
+11.2
+c9dd1957076d178055ab58f811f33191d5457120b8bb0c41217cdd85e0e371dc79dd64584897413f6b5045c5aeeb866fbfd311c32e44cd00fff7ca347765a5c6
+11.3
+350c51abe5a7178b6a0981bac3a6c5227f5154724e402982363434a9f16fcd9813f074dc1e6190d9cdbe5f21cea5cb8bc072e54058c10a9e09f8a6ddc13f1c2b
+11.4
+f1407747d6b8c676b20cc10422d589a7db426f9ad269b1f687fbab2d4e24bc7060e985201797859229f70b3a569121e967cf3159182aaaaecdf0e99906aa0e2f
+11.5
+6198de2d30c5096fe27fe22283a8176284cb725bec2621c7764e1d1d3af406836f36541d76bd5a29b9684a8a6c126ea40840bbd417b1eef26ceb151fd632a4c5
+11.6
+1ec963f3d54ce51d8c373320c130424f0be89ec537deb972e36d6ab134b2cf6a3563c8c9ddaf1690e820410c3de911920289445c7e09e7fe5e32cb7cbe131b29
+11.7
+26249d443d9324c7695276d81dd178905fccecdb97711863ba7fa285588f1d8e79d4048624bd24c95b9c28af3007de124b8e3aa073072beaa2b0730dc02ec7bd
+11.8
+b6282b22b01469111f2084ef2a06806d85610c33b8a5be5f391af8b0b4c7c52af754bd75b4ea09f92fe204674f33edd828e392276629d6ac6dddfb3b975f505c
+11.9
+7a57fac361d99355de441933599c8164c371660d0994def88ed7ec6086762270dcc63a812059a44d528fac5db75c542f5707fe22de1673671f1c3f89b644a816
+11.10
+1b22d03a1d7fa64c0d3e66f8079e2b284d8cf3ab47feef0efd563b2a4e623c5e3bb649af2e3c1f4d6b20af9e3b4684e77f7a084b018e68f20dc0d7458e3bd900
+11.11
+a21121ebb87adfccd5db36e36a5a1fc115b87a8ab7354b913d68e613e465bca8b68521056cabe6ad2f12c47bd1042fe7ee9086423751e6f203eca279920d60b4
+11.12
+b948e2281ab6ca18fef8c7bb3869b29b7ddfea3455cfaf783fe9ff79659b00478cfa38a7e5572e0efabaf07247c2b6be580415219881495655cd2c8aad5570fb
+11.13
+1513e266f1de657d6c8a328a82fdb18439bee129bf8cacdb42553cf6b587f26f8ff5c72f543d3473d0c2eafab05d94534dca281089fba5e7b85a029397a1dafd
+11.14
+b4ca3519591d0b4377babaeea3ed52525ea052594f22b70d978e301075675d2ebbbbdcee96a0842f1fde01c87e20010c7fcba0c2916112ccb9ec8e2709d38f85
+11.15
+b4a62f166470023ebc50b6ea635694e0f99b38efb5a8c5ad35ea8c31e025ea909c42c56424296e97cbe15c6f84a2e52c589bddc31f56d4a70b87f9067396a739
+11.16
+0a01b800342c30aa072eca6cad2c96f4ddd1090d7869d66908770372b2ccf846a173365802a86bad0331080303dc3a35b98b4d9e564ee30a9ef1c06e9536ec7a
+11.17
+1d6a02ede40f76ec3a68482fede5bc9428187d0f9e436e82a54dbee744018ee1393891f77045d0bc7bf9434bdd8183edcc8196543da86f13950e5915cd056298
+11.18
+4da492fd5d5b489c07696490420db64b60027da4da61ba8efbcf27fa19f0bfb614bc48703c34bb94463b69480700c2f26ae4e8d87768ac21035af2c2272c03dc
+11.19
+aab00904b90035441e66f099a768b65ca83d7e8d30cf090d24bb00e909aec531317b1edd843a79a7851bcfe3cc2b8bf4b677da2a6c8c5f0925f3581b16f57576
+11.20
+6b9406ead3271325f40b32a3bda06c07be98258f77fe05732d546e3a9ede44e1400412c51201ee4847359dfedbfcfd5108f02f4d1dae42e5c44479cee3c5318e
+11.21
+65c87cb831cdadd9658f660c601735143679b900036e7028b343b1f18c24457369033363c9dfa6d365bf2a486b5deefe4304b51ceec5fd04dfe2bb943a2d83cd
+11.22
+d9f73ad9c762f19249f1ac3badd62b5cb8fd298a96cbb7c5cdc1026f9f600ef4d088cd61edf26f7650b27d234d34e30a2ccd112db9a8307810029e1feb1524e2
+11.23
+b72b9b16a36feb3b3efc5d8e57b7eae6224163ee64a7ed74c4b1b7219ad44b61073334e05a33836f0c3574284b10a2e88441ceddfffee439b4de331e806c7180
+11.24
+6cfc59c3e8d8660a09a236311220829b41d2fb0e4f87e05ca711d77be59cf7cfe6c1018ea70964ac55daf68a6db57607b3c1ff44f6b7caa399bbdc2b1a2bbf7c
+11.25
diff --git a/C++/Menu System/drink.txt b/C++/Menu System/drink.txt
new file mode 100644
index 0000000..0b5f339
--- /dev/null
+++ b/C++/Menu System/drink.txt
@@ -0,0 +1,52 @@
+56f0b7f05ccc6f2dbfb04af6165d1a7fcb7c07043d2cfbc6f1fae0edcfb8b30117eda2f7f5e04c2a31fbae837a93c81721dac9d706d3ab67cad20272d33da532
+11.0
+058e17b47f39fc4893a936f4cdb43d13175c44d8208e18bdc545f4665d97c08003d0fbeeb702cb01f19075b3ae62c45ef3404420ded3b2ca1eeb6e6ae8573e08
+11.1
+2a9c1bb9222205353ff90ff0a1deb05049414847d3385b9bdb8454917125be24f9895b6574d25652e04d07e7a2be75b78acbd09fa73c055116399a1e5020a0bf
+11.2
+08c042b5fb6c5429faedc156870c5c637cab1a2e197ad0621ce626b811eb4c20840e12e0d83ec6d28b44f244ea33180fcc7d5e2aa704531a39410cb87c886980
+11.3
+f1ccd328a1b429b66610942ea459e1661a9faf9c99788025c1ed7cd280349a3a82a8c9b46f89a2a527144084d8be103612786caf1734692897b1f204bda69476
+11.4
+be08210a3a363ddf6096cd34a240e1ada1f6fdef5c75bc8b1091bf5764e5326c007833b64aff3b454ccfa6c6ed7259879ead4ca6989a97494de5a07ab28051c6
+11.5
+baf2ced1eefc9202e7b29ffd209b41028d4390f5651eb211061b91393d8464a31c702f17fe7f3e9425e06e9b850464c76eb29731c6dbba97474bdf91f25eb6d8
+11.6
+3c1c189c0837f71eac0d941c73c47abf9f28fcb5c352f7b3ed5e666d23aeb11f5170fe5e5af5369352f331c6906fd5e92150705d1591d65edbfd8473e1f51a8f
+11.7
+9b7552196d9a8a14d66ce547c033c0293e4d8076de3fbff25d8903881802dbc7e02bf531b2baaa2fefef1c0a7594bf79bdfd13af9e5f5b4fb355d0171a648571
+11.8
+c0fe9a0d171f6254074aa45cb97fe20cee87760cc2ee7f8d19d3f3d87cbc1103e8f198baca012436a6c4e5ba3136281ba01e855536d36774be3b0e0f8800aecf
+11.9
+6ca06062e29a97237e10094a52be11892a2185bac1957249a4e4fc2017ddd2aa360a7266b2ae7e57faa65436bd16219d5ed2621c7bdb73fb2864fd4445f8d625
+11.10
+002aa905deb001df5ef943239c562cd19d5d425a9feeb6c1a2c07cb0d73f3dfd7d8a8349ceca13be344173d0be19635207824ee6aae8af0b7a2cd543bcc7093a
+11.11
+3e27e6f105f8bb292e895ec6ca6ed570676f9e6d6c77ba54f4fa723ac1a1371b5aa05bd6251880b66b4578d2055c85c279aad06b0ba195793a9a2a6e49862775
+11.12
+a537552312a4b772b396a5476ae8bd37fdf29e7c0699e899d67207b40628cf9b452075b1656dfd4beec129f0f30787db46463c53b1f8b6b2a58d1e83a11d4a57
+11.13
+b0d7843ea6aa3d82b834795d053ab58c014b840fa079852cb3a4fcfa4a9e9fd62bbcf9eaf8b864a7186b2b9a797b884076a57c525d7cc9e7318ab872e613a6ea
+11.14
+32e5d43e743fac5a27eb26a695ee612985dd62127085b06ce3c60029fd40866a903602da9bbff4cb45e4722e9f728ad7bedb770386e376aac384ca94a4b9e2d5
+11.15
+25766e2c13bbc66510d0c16bcc4df49a22f195c3284ae38eb672076884639cfd387de7b323d7a71e247df1385fdddf332361d013c4e4d2229445467a8c21179b
+11.16
+13c8a914be25e3cab13d455b675240d7e2c5ecc37d65515f7ac7ed3ba5bc3033799ed4ead64deda2e7a5032be1a09a1e9a01067cb93ad7523a32731f556fcad1
+11.17
+19d33012789795bb81627242127364dd10502c668ad8fc02d8bb9bee0dd3c29d40110ce01081ee7ca895b18777fc1d9756c08975f93b2dfef4514d625c430871
+11.18
+78f2c0f8483e1dfe5e77fa5bb893c52e5ee3bda65ba5824ff9b0e4bab6b1c209a3ab79ab554a0fd713a80712f0b6ee488838584a77e7ea895161756e8f6a5483
+11.19
+8e0e31a9c44e75478e2038473a35859c39734e3328be15ffafc46e1bab199adf702f38273edb61a53d753df8f1bcb9b4620fcea38db1d4b65a1e6814d5be0a10
+11.20
+1d1e2407524de257f989f87dd74afda39b446987d4cd5cbcc654f400d5f03c906c6f99ef9221ebd67407ec20aa64c6c1c1d8628de70e95a9d5a5da9837e26eff
+11.21
+574fd289986ac716700171d0732fea05f24baeb2c8729d1571b8c8e28f4ec836137c1b2f71f4ad69a1db801eb05e03774e608c5814278eef8bf5221f5409d865
+11.22
+bd5f31a7a4efe171ab64f718b4424cf163516539dfa4c2b5747c94bbe024868c17c0bfcdd1282490b9c522eb14328c9d21e574789aaf41b0d615aa787dd45192
+11.23
+8a4b7cb24962c6af5dc03eed74eb454665f2100bae7ae18eca4f8f0f265f2db138de08c6f60fa17996491b37136cfc125378b25a062a2bc1b367c2b648258bfe
+11.24
+874a9b179ec01c0efc6f0d07a5c7172375b845ab99ff4aa8e492f2e5df94226c302a690e8e422957dfc7226c368a7635650417295e8900e94dea1658522cd291
+11.25
diff --git a/C++/Menu System/entree.txt b/C++/Menu System/entree.txt
new file mode 100644
index 0000000..b92632e
--- /dev/null
+++ b/C++/Menu System/entree.txt
@@ -0,0 +1,52 @@
+6853f441a3a2682760675935ab4f81e48d3ecb88baee75f5cba5c524764ed971124544f8b5979dcd36d402debfb89245f77d0301e44e8b78e7057775b16d32e5
+11.0
+56c37ffd72fe2a07cf7dcb58cebae91d1bb3940b5616e28519be40d77e2f450c43e30b1cfde8de236703bdb6fb991441cd6c6ee0ec972ff35152c0c5bad4f404
+11.1
+1673977affd4c810a109d6d87d12f02c29112a0167d454dd949d77945d59176ae0bbcb0d9affe247decb817819fb8724c990ceb2aedc45e3b38cb5360f283576
+11.2
+f396b78527162dce006c9d433079f110a54162419d2487aace5a8b87eb50274b3a50b6980bef09735e9dd4ea1b8a364628b321f41f8c6e2b00078899804894a5
+11.3
+397c5a1d3a5636661fc49be7a22960238a7e9279b9365113b1f3848a07d0428d58b9dbc6733e967805b62c3b55e0d45aa009ed4be4f1b89006aea366ee8ebd79
+11.4
+75895edce9ec70c0c920cd09e05ac45a20bf4c648f58eac509b646af938c48c30007843cf294ac379604660fa863469586087ddfaa159b3f57237728aa4dcfbb
+11.5
+d862a4af2352bddae02c340fb885cb124cd811ccf21317a79e370a4fc4d5709a0036b04a53db0a2c92aa2247b192fc07d50f48c956fe7310fc8b13ce6bf253a9
+11.6
+cb4dc1f761e88ffa929f703f295f78366993533ceaac9f8416e12cfb491049bb6dd106e9e769c8ca105307a7ce849990a554017d3269f54f5f23372d520b4548
+11.7
+c41931432c02006cf825a30cd1b0f3b9bdf9a0002ec5129be204bcdf0a48eceed7ef1bf2fa39e210c3d9c2df4e928f72efa666a32c64c7e3b9872ad11b3a2d26
+11.8
+87d53750655bc1ce70ee1d03a20fa3b4ef95920b4b6382dc856b707710348259237b2def1066314b19c60474b87b9ea5299d6676dbbfc1d79d0d804d3a203739
+11.9
+5849ff292f86b2367a2bd4d5b49a5dae95dbe8aeb4e6909d96f3251b7abafc8a6c4e0d95c6415f8f5f69ebb64af388449f35d343acffd8c79281083012faa1e1
+11.10
+d00893acaf2c24b98b506e2306520596112ed4f565e8f4d1b8a7792a6c1fa27fcab91bb9cfa6b61e06fbc04a081eca896eee3621d099b743e55a04a7ec73ab88
+11.11
+16bed777c21f0a8b1783f609f93bcd80e28a6e72d389069829780c05a5296079f9e7218fad422fd61a00cdaa8b79f31b151c1e203b5c6979c34a5edd8445d9c2
+11.12
+dfe14430562ec32d1b1e015cdf440260f34049f4df66a33eca732da3d6a0e1823b0a6432df4045ba730d2edc7216265d140fec4406c2180e2d1994f1020ece0a
+11.13
+aa0781d483fb27899c315acacdd8d3d9e8952ae423ffdff984d00287148dd3cba8ab3acfdbef24bb6c9c9f14c56cee1f735953000db7bbdf4da84ca6d3cea4e4
+11.14
+22f86a3c7228c924b1d51c47f3631e043895cf5d3a91597c042c4f24c27ff105765b57af5186613f9f643ecdbb35a858d7cc44cb3831f29f2caef7c387e408a1
+11.15
+0ef0e7d3ce49752c4c5c82482f816ce73ada2420fb73af14ad1e375afbe529e047acb7e8c8ea1f5c979e17367b0260b8c3b411db88d8e757887fd834bd5d2e81
+11.16
+2de8a7603a1b743f80b96a2991638f2844e0406ec4772816eebe2317040dca15ddf466ff135c85f4b0fc9e6c1f382d4f2d615acbcd95f47bb9777dbaaa7a0c69
+11.17
+98edd7b1d6e050e19699ed0a3a8bf01cb7e34210da4c52455fa06c6b635334cbfd309de0b250beaa871c2bb76d21886847503ef97af6c5780b1469e39fe10f7f
+11.18
+e452529f95008a1e5c9d1f258580bfdf997767033592bb3fade63653fd6f523dbc103341313b1a53ad2b034bad7922c40e0523ee1133be854ee696c96e1c0864
+11.19
+ed4f8ca33238517e3e1cd2a6fa575807329449612998a9bf1194d6c053635f63b6ff772c587e3684c2004ac54ab674bbe4f51b3cea7949783f8bdee76c7eb760
+11.20
+accf96c59b3a3bdb0f184c5e23cb506b5e24b56effb1a899a164f36d819c55ee51292cca9c9b8349074260a497070e84bc14c70456749d99c9505cef15240d10
+11.21
+2ae656dd129bbc3b3c969ef697a4b0e4eb29f451ce57bfea6753751e13990b50c8fa8dd8072b2d314cc5d4968eaae5b001663902d172639735e3a7703dc3ebb9
+11.22
+5aaf903182145b1eea3ffdb01c7295fb695dbaf98a71eb2458eadd93764a3b4f1179bcc2ae5786421218d3bfaf754b59327007ef196cb272737256fc42012147
+11.23
+10b34a21732c9a7a43b21f3b1b2c22e58a62bb15514930c226f37460afdcc4dab4fe7da722fdd90f4624f167bdb8c7abd638bfcdc3d9fa926223dd4ef54a3ae9
+11.24
+759764bea005964d266062acf2c7cb0ab10179fe5d5a050277a0c31250929e10a26e9712ac4dd7289e626432211912540648f225396a2d8270743c278db31dde
+11.25
diff --git a/C++/Midterm/Instructions.txt b/C++/Midterm/Instructions.txt
new file mode 100644
index 0000000..6939ed5
--- /dev/null
+++ b/C++/Midterm/Instructions.txt
@@ -0,0 +1,45 @@
+ For your midterm project, please write a program to do the following:
+
+ Use a struct to:
+ Create an array or vector variable to store a person’s favorite movie
+ Create an array or vector variable to store when the year that movie was released
+ Create an array or vector variable to store the box office gross (total amount of money) it made
+ Create an input file to store all of the above information. Please use at least 3 sets of data to make the program interesting
+ Check that the input file was found
+ Use a loop of your choice to read in an unknown number of records from your input file
+ When the program reads in a movie name, check to see if it has any <HTML> tags inside of it
+ Once the movie name is free of tags, store it and the other variables in your arrays or vectors
+ Use a simple menu where the user can sort the data on the movie name, year released or box office gross
+ Output the sorted movie list onto the screen
+ Close your input file
+
+Assignment Notes:
+
+ You are free to use arrays or vectors. Or, you can mix/match. It is up to you
+ I expect to functions for steps: 3 - 7
+ I expect to see generic functions for step 6 (sort function) and 7 (output function)
+ I will be closely watching for cheating (copying from friends, online help, etc.) and I will give 0/300 for cheating
+ There is no output file in this assignment, but if you want to use one, you are free to do so
+ You are free to make all variables strings for simplicity in your sort function
+ You are free to place any/all of your functions inside of your struct. This is not required though. You may do this or not. Your choice
+ For the box office gross, you can abbrev. the number to make it more manageable. Example: 100, 110, 250, etc.
+
+General Notes:
+
+ Be sure to use comments in your program: Name, Program Description, Date and anywhere else in the program you deem necessary.
+ Although this is a midterm, if you are stuck, I will still help you! But, not as many answers this time. Nothing here is new, so you can review the keys from your assignments to see how everything works.
+
+Grading Rubric:
+
+ If you do not include comments at the top of the program (name, program description, date), you will lose 15 points
+ If you do not use a struct, you will lose 25 points
+ If you do not use functions, you will use 20 points per missing function (80 points)
+ If you do not use generic functions for steps 6 and 7, you will lose 50 points (25 points each)
+ If your program does not compile (run), then I will give a grade of 0/300. But will give you the change to repair for points back (some points are better than none)
+ If you use global variables, you will lose 10 points for each global variable used
+ If your program is not formatted nicely (code all over the place, ugly), you will lose up to 50 points depending on the extent
+ If your program stops working when I run it, you will lose points. The exact amount depends on the severity of the error
+ If your program still has your friend's name on it, I will send you a message asking you to try harder while giving you a 0/100
+ If your program looks like a a professional programmer wrote it, I will write to you to ask if you want a job. Well, maybe not. But, I will ask about the code
+ This is just a list of typical issues I run into when grading to give you some idea of where your points go. Points can be taken off for other reasons.
+
diff --git a/C++/Midterm/Midterm.cpp b/C++/Midterm/Midterm.cpp
new file mode 100644
index 0000000..e79f58e
--- /dev/null
+++ b/C++/Midterm/Midterm.cpp
@@ -0,0 +1,280 @@
+// Name: msglm
+// Date: Oct 3rd, 2022
+// Program Name: Midterm
+// Description: Read in a file, sanitize said file of html tags, output the contents in a format sorted that the user chooses.
+
+//90% of this is self-plagiarism, or as I like to call it, recycled
+//and think, some people get really angry about reuse!
+//I never understood that mentality, it's just absurd to me:
+//just never transfer your copyrights and also put your code
+//under a free software license and this won't be a problem.
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <vector>
+#include <array>
+#include <iomanip>
+using namespace std;
+
+//Structures
+// Use a struct to:
+// Create an array or vector variable to store a person’s favorite movie
+// Create an array or vector variable to store when the year that movie was released
+// Create an array or vector variable to store the box office gross (total amount of money) it made
+//
+struct Person {
+ vector<string> favMov;
+ vector<string> yearReleased;
+ vector<string> gross;
+};
+
+struct Movie {
+ string favMov;
+ string yearReleased;
+ string gross;
+};
+
+
+//initalizes the file
+
+//with the amount of times I used this function, I have to wonder
+//why I don't end up making my own standard library
+//or code processorsor to catconate some standard stuff
+void initalize(string location, ifstream & fileVar) {
+ fileVar.open(location);
+
+ if (!fileVar) {
+ cout << "ERROR! " << location << " failed to open!";
+ exit(1);
+ }
+}
+
+
+//borrowed code from another assignment
+//
+//it's great that I made this not have any side effects
+//I can just slap this down anywhere I please
+string sanitize(string userInput) {
+ bool insideATag = false;
+ bool metTheTagTerminator = false;
+ int beginBracketPos;
+ int endBracketPos;
+ int tagLength;
+
+ for (int charPos=0; charPos<=userInput.length();charPos++) {
+ if (insideATag && metTheTagTerminator) {
+
+ //Tag length only exists because std::String.erase() doesn't accept
+ //a range, but rather a start and the chars to go. it's accursed.
+ tagLength = (endBracketPos-beginBracketPos)+1;
+ userInput.erase(beginBracketPos, tagLength);
+ charPos = 0;
+ insideATag = false;
+ metTheTagTerminator = false;
+ }
+ if (userInput[charPos] == '<') {
+ insideATag = true;
+ beginBracketPos = charPos;
+ }
+
+ if (userInput[charPos] == '>' && insideATag) {
+ metTheTagTerminator = true;
+ endBracketPos = charPos;
+ }
+
+
+ }
+ return userInput;
+}
+
+
+//takes a file as input and, for every 3 lines, puts it into the movieDataContainer's vectors
+//Will only run if the next line after a set of 3 is not EOF
+//there is no error checking
+Person orderAndAssociateIntoStruct(ifstream & fileVar) {
+ Person movieDataContainer;
+ string temp;
+ int oscillate = 0;
+ int epoch = 0;
+
+ while(getline(fileVar, temp)) {
+ switch (oscillate) {
+ case 0:
+ movieDataContainer.favMov.push_back(sanitize(temp));
+ oscillate++;
+ break;
+ case 1:
+ movieDataContainer.yearReleased.push_back(sanitize(temp));
+ oscillate++;
+ break;
+ case 2:
+ movieDataContainer.gross.push_back(sanitize(temp));
+ epoch++;
+ oscillate = 0;
+ break;
+ if (fileVar.peek() != EOF) {
+ break;
+ }
+ }
+ }
+ return movieDataContainer;
+}
+
+
+//Prints out all the data in a tabular format
+void output(vector<Movie> movieDataContainer) {
+
+ cout << left << setw(16) << "Movie Name" << " ";
+ cout << left << setw(16) << "Year Published" << " ";
+ cout << left << setw(16) << "Gross Box Office" << " ";
+
+ for (Movie movie : movieDataContainer) {
+ cout << endl;
+ cout << left << setw(16) << movie.favMov;
+ cout << left << setw(16) << movie.yearReleased;
+ cout << left << setw(16) << movie.gross;
+ }
+ cout << endl;
+ }
+
+
+//Bubble sort implementations
+//
+//depending on the menu option selected, this will sort by different values
+//The movieList is read for all the movie structs in it, those struct's values
+//are what are read when sorting happens. Depending on if the sorting deemes the values
+//greater or lesser, the swapping of the movie struct itself will happen
+//
+//It took many hours in gdb to discover that this function had a bug due to
+//movieList.size() returning 5 instead of 4 if 4 movie structs are in movieList
+//
+//The experience of debugging C++ seg faults is only comparable to one thing: passing a kidney stone;
+//It takes 3 hours of your life away, it's painful, and by the end of it, you'll be bleeding out of places
+//you never thought you could bleed out of.
+//
+//The only upside to debugging C++ code is that it doesn't bill your insurance...
+//well, it does end up billing it later on when the blood pressure problems start setting in, but right now that's not my problem.
+vector<Movie> sort(vector<Movie> movieList, int menuOption) {
+ Movie temp;
+ switch(menuOption) {
+ case 1:
+ for (int pos = 0; pos < movieList.size() - 1; pos++) {
+ for (int comparePos = 0; comparePos < ((movieList.size() - 1) - pos); comparePos++) {
+ if(movieList[comparePos].favMov > movieList[comparePos + 1].favMov) {
+ temp = movieList[comparePos];
+ movieList[comparePos] = movieList[comparePos + 1];
+ movieList[comparePos + 1] = temp;
+ }
+ }
+ }
+ break;
+ case 2:
+ for (int pos = 0; pos < movieList.size() - 1; pos++) {
+ for (int comparePos = 0; comparePos < ((movieList.size() - 1) - pos); comparePos++) {
+ if(stof(movieList[comparePos].yearReleased) > stof(movieList[comparePos + 1].yearReleased)) {
+ temp = movieList[comparePos];
+ movieList[comparePos] = movieList[comparePos + 1];
+ movieList[comparePos + 1] = temp;
+ }
+ }
+ }
+ break;
+ case 3:
+ for (int pos = 0; pos < movieList.size() - 1; pos++) {
+ for (int comparePos = 0; comparePos < ((movieList.size() - 1) - pos); comparePos++) {
+ if(stof(movieList[comparePos].gross) > stof(movieList[comparePos + 1].gross)) {
+ temp = movieList[comparePos];
+ movieList[comparePos] = movieList[comparePos + 1];
+ movieList[comparePos + 1] = temp;
+ }
+ }
+ }
+ break;
+ }
+ return movieList;
+}
+
+//just a simple menu. returns a number because I don't feel like dealing with flags
+int menuOption() {
+ int choice;
+ //No input validation here since the rubric doesn't call for it.
+ cout << "1. Sort by Movie Name\n";
+ cout << "2. Sort by Year Released\n";
+ cout << "3. Sort by Box office gross\n";
+ cout << "Enter Selection: ";
+ cin >> choice;
+ return choice;
+}
+
+//effectively inverts the person struct
+//instead of being a struct with vectors in it, it's a vector with structs in it
+//and those structs hold data about an individual movie
+//
+//This is achieved using a similar algorithm to reading in the file
+vector<Movie> person2MovieList(Person person) {
+
+ vector<Movie> personsMovieList;
+ int oscillate = 0;
+ string tempfavMov;
+ string tempyearReleased;
+ string tempGross;
+
+ int moviePos = 0;
+ //Since gross and year release are associated with movie, we can assume
+ //that for every movie, there should be a gross and year release.
+ //
+ //If this was in production, some type of check would be ran to ensure this
+ while(moviePos < person.favMov.size()) {
+ switch (oscillate){
+ case 0:
+ tempfavMov = person.favMov[moviePos];
+ oscillate++;
+ break;
+ case 1:
+ tempyearReleased = person.yearReleased[moviePos];
+ oscillate++;
+ break;
+ case 2:
+ tempGross = person.gross[moviePos];
+ oscillate = 0;
+ personsMovieList.push_back( Movie() );
+ personsMovieList[moviePos].favMov = tempfavMov;
+ personsMovieList[moviePos].yearReleased = tempyearReleased;
+ personsMovieList[moviePos].gross = tempGross;
+ moviePos++;
+ break;
+ }
+ }
+ return personsMovieList;
+
+}
+
+int main() {
+ //Variable declaration
+ ifstream data;
+
+ initalize("input.txt", data);
+ Person organizedMovieData = orderAndAssociateIntoStruct(data);
+ //This current data structure makes the sorting section a nightmare.
+ //this is due to the lack of a hard associations between the movie's name, year of release, and gross profit
+ //
+ //I somehow must associate those three variables despite them being in an array
+ //Instead of using an accursed flag system to accomplish this, I will instead opt to
+ //just convert the data in the Person struct into a vector of Movie Structs
+ //this way, the order of the struct may be managed much more simply
+
+ vector<Movie> personsMovieList = person2MovieList(organizedMovieData);
+ output(sort(personsMovieList, menuOption()));
+
+ data.close();
+
+}
+
+/*
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License Version 3 ONLY as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
diff --git a/C++/Midterm/input.txt b/C++/Midterm/input.txt
new file mode 100644
index 0000000..3d5fe35
--- /dev/null
+++ b/C++/Midterm/input.txt
@@ -0,0 +1,93 @@
+A Bad Movie
+2009
+1000
+A Mediocre Movie
+2013
+2000
+A Good Movie
+1963
+3000
+<html><p>A Great Movie</p></html>
+<html><p>1933</p></html>
+<html><p>4000</p></html>
+<html><p>The Best Movie</p></html>
+<html><p>2019</p></html>
+<html><p>5000</p></html>
+<html><p>8daf42144e1478242395</p></html>
+<html><p>5277</p></html>
+<html><p>17323</p></html>
+<html><p>992db78074b6626d32d4</p></html>
+<html><p>28144</p></html>
+<html><p>18078</p></html>
+<html><p>eff5f2d89c76c7db845d</p></html>
+<html><p>2097</p></html>
+<html><p>4657</p></html>
+<html><p>5b2ab0ef7c7679608ad4</p></html>
+<html><p>21667</p></html>
+<html><p>22384</p></html>
+<html><p>af130ea34c5fd18e5d90</p></html>
+12932
+16067
+53781f8b44d59f0a785b
+27052
+15023
+4fb5031d3f412c8eaa00
+5108
+19262
+e5ef1bffca4fc724bc1a
+22484
+28116
+f176f40d7d95a68c505b
+32107
+11837
+026b0f5819e4f3b1f896
+19896
+8728
+a0cb012372c799465445
+15028
+11357
+de61b87cde83b8a34bb0
+<p>32308</p>
+22373
+5c0bf606be264bdf0c0f
+22526
+30093
+0ba47d1c54af6d4f0cb6
+19016
+30532
+f7210a737c1e1ffc7c6b
+25482
+22580
+8d2bdb0dc90b60deff84
+10442
+30759
+e99b69172334e6898221
+7135
+5818
+facdeb2cacd8ba502e6d
+16070
+9232
+4568ec6386779c896ae2
+10475
+4969
+d4ca7742c45d8600775d
+31616
+23407
+a604d311130b7bdb5d44
+21036
+25900
+b3c333742475448abd99
+5663
+26144
+ce41c8b616c312ba742c
+12394
+28147
+916bcad86d3071937283
+21493
+11734
+6fafd30cb753057940bd
+7217
+8621
+7c13bda784439ee8e995
+20462
+22245
diff --git a/C++/Multiple Inheritance/INSTRUCTIONS b/C++/Multiple Inheritance/INSTRUCTIONS
new file mode 100644
index 0000000..7f67b29
--- /dev/null
+++ b/C++/Multiple Inheritance/INSTRUCTIONS
@@ -0,0 +1,43 @@
+Project 9: Multiple Inheritance
+Due: Monday, November 7th, 2022 before midnight
+100 Points
+Using the "Dreaded Diamond" example shown in class (or one you find online), write a program that has a base class, 2 derived classes and a join class. The class names and behaviors are up to you! But, I want to see the following in your program:
+1. Each class will have at least 3 variables (in the private section only please)
+2. Each class will have least 1 non-trivial function (must have substance, not simple overly simple) as well as any functions needed to get/set your variables and/or anything else needed
+3. The join class will use information from each of the derived classes (otherwise there is no point in doing this assignment)
+4. Create only 1 object. It will be in main and be for the join class only (no reason to create an object for other classes)
+5. Main should have the creation of an object and function calls. Nothing else
+Program Ideas:
+1. Base class of video games, then 2 derived classes: 1 for mmo and 1 for fps, join class is reviews (review video games - parental rating, star ratings, etc.)
+2. Base class of person, then 2 derived classes: 1 for student and 1 for faculty, join class is tutor (create a tutor log that shows who went to the see the tutor, the name of the tutor and student, class name, date, question, etc)
+3. Base class of employee, then 2 derived classes: 1 for worker and 1 for manager, join class is payroll (workers are hourly, managers are salaried. Determine the paycheck for both - just like you did in the previous assignments)
+4. Base class of movies, then 2 derived classes: 1 for genre and 1 for actors, join class is boxOffice (store box office gross, year released, movie rating, etc. Then, sort on something, such as gross - just like your previous assignment)
+If you don't like these ideas, that is okay. Make your own!
+Assignment Notes:
+
+ Be sure to make use virtual when inheriting from your base class! (watch the video examples to see what I mean)
+ Make variables either arrays or vectors - your choice
+ Use input file or keyboard to get data into your program - your choice
+ I expect to see functions throughout this program
+ I expect to see all variables in class private sections
+
+General Notes:
+Be sure to use comments in your program: Name, Program Description, Date and anywhere else in the program you deem necessary.
+If you are stuck, I will help you!
+Grading Rubric:
+
+ If you do not include comments at the top of the program (name, program description, date), you will lose 15 points
+ If your program is not object-oriented, you will receive a 0/100 (OOP is requred for this assignment)
+ If your program does not use functions, you will lose up to 75 points (depending on the number of functions missing)
+ If your program does not compile (run), then I will give a grade of 0/100. But will give you the change to repair for points back (some points are better than none)
+ If your program is late (within 48 hours of the due date), you will lose 25 points
+ If your program is late beyond the 48 hour due date, I will typically still accept it, but you will lose far more points. Depends on when you turn it in
+ If you use global variables in your program, I will deduct 5 points for each used
+ If your program is not formatted nicely (code all over the place, ugly), you will lose up to 25 points depending on the extent
+ If your program stops working when I run it, you will lose points. The exact amount depends on the severity of the error
+ If your program still has your friend's name on it, I will send you a message asking you to try harder while giving you a 0/100
+ If you submit a file type I cannot open, such as .sln, you will receive a 0/100. You will be able to resubmit for credit, but you will lose up to 90 points (depending on how late it is)
+ If your program looks like a a professional programmer wrote it, I will write to you to ask if you want a job. Well, maybe not. But, I will ask about the code
+ This is just a list of typical issues I run into when grading to give you some idea of where your points go. Points can be taken off for other reasons.
+
+
diff --git a/C++/Multiple Inheritance/MultiInheritance.cpp b/C++/Multiple Inheritance/MultiInheritance.cpp
new file mode 100644
index 0000000..4ddaf21
--- /dev/null
+++ b/C++/Multiple Inheritance/MultiInheritance.cpp
@@ -0,0 +1,280 @@
+// Name: msglm
+// Date: Nov-7th-2022
+// Program Name: Multiple Inheritance
+// Description: Toying around with inheritance by making a program that calculates the only thing worse than OOP: politics.
+
+
+//My last project got some marks off for my parent class doing nothing, and i'll admit, that was the case! My parent class was a glorified struct and might have been a bit too sensible to be considered OOP.
+//So, this time around, im going to channel my inner Java developer and make an abomination example that both fulfills the rubric AND provides some examples for why OOP should be tossed into the trash.
+
+#include <iostream>
+#include <fstream>
+#include <string>
+using namespace std;
+
+//Classes
+
+
+//This person class refers to only one aspect of a person: their ability to pay taxes, however, objects in reality are much more complex than this.
+//I can foresee someone modifying this person class with much more, such as the ability to eat, drink, read, work, etc. and this thing "person" becoming
+//more feature complete as time goes on depending on what's necessary. This isn't a bad thing, however, when combined with inheritance it leads to disaster.
+//
+//Even if you have a conventional subclass of person and not a strange one (i.e my company subclass), you will create a very bloated being. One of my subclasses is a
+//politician. Right now, this is a sensible decision as a politician's taxes may become important in the program later on, however, if the person class keeps getting
+//more and more bloated, this may become absurd. A politician eating or drinking, doesn't really matter depending on the scope of the program. If this was a small government
+//simulator, it'd be unnecessary to cruft up the politician class with junk about eating if the politician class only needs certain aspects of the person class.
+//
+//This can be solved with intelligent programming of everything on your system, but assuming that your development team is perfect is just a bad idea and assuming you can keep track of everything going on in a big project is a worse idea.
+class person {
+ public:
+ float calculateTax() {
+ if (alive) {
+ return income*taxRate;
+ } else {
+ //The dead can't pay taxes!
+ //
+ //...well they can with death tax, but
+ //I don't feel like thinking about that kind
+ //of government overreach, especially in an assignment
+ //meant to make fun of OOP, not the government.
+ return 0;
+ }
+ }
+
+ //I don't like metaprogramming, but things like this are why it exists
+ void setIncome(float i) { income = i; }
+ void setAlive(bool i) { alive = i; }
+ void setTaxRate(float i) { taxRate = i; }
+ void setName(string i) { name = i; }
+ float getIncome() { return income;}
+ bool getAlive() { return alive;}
+ float getTaxRate() { return taxRate;}
+ string getName() { return name;}
+ private:
+ float income;
+ bool alive;
+ float taxRate;
+ string name;
+};
+
+//Some people say that the legal rights of companies encroach on the point of
+//personhood, especially after Citizens United v. Federal Election Commission.
+//Due to this, it's concievable that in some program, somewhere, someone will
+//inheirt a company from a person despite them being very different things in reality.
+//
+//This serves as an example of why the class-based way of thinking can rationalize very stupid things:
+//A company is not a person and doesn't act like a person by conventional reasoning, however, using
+//particular and contextual reasoning, reasoning that may only exist in the programmers mind, you can
+//justify incredibly stupid inheritence like this.
+//Of course, this example is almost absurd, but you can see the idea here. I don't know how many times i've seen people
+//attempt to make the "player" a subclass of a generic belligerent class when developing an RPG game. Every single time
+//it leads to the player class being an overbloated abomination due to both being developed and added upon to account for
+//niche circumstances. By the end, the player and the generic belligerent class don't even remotely resemble eachother.
+class company: public virtual person {
+ public:
+ void cleverAccounting() {
+ if(hasAccountant) {
+ organizationTaxableIncome = calculateTax()*0.5;
+ } else if (hasLawyer) {
+ organizationTaxableIncome = calculateTax();
+ } else {
+ taxDelinquent = true;
+ organizationTaxableIncome = calculateTax()*2;
+ }
+ }
+ void setHasAccountant(bool i) { hasAccountant = i; }
+ void setTaxDelinquent(bool i) { taxDelinquent = i; }
+ void setHasLawyer(bool i) { hasLawyer = i; }
+ void setOrganizationTaxableIncome(float i) { organizationTaxableIncome = i; }
+ bool getHasAccountant() { return hasAccountant;}
+ bool getTaxDelinquent() { return taxDelinquent;}
+ bool getHasLawyer() { return hasLawyer;}
+ float getOrganizationTaxableIncome() { return organizationTaxableIncome;}
+ private:
+ bool hasAccountant;
+ bool taxDelinquent;
+ bool hasLawyer;
+ float organizationTaxableIncome;
+
+};
+
+//Now, this reasoning is conventional. A politician is a person, but this class will suffer many of the same problems the person class does by being able to be edited to maximize bloat by other programmers. If your programmers aren't editing this, then they're making subclasses that over all just make the program more confusing. Nobody wants to keep up with politician_who_can_eat_and_drink and politician_who_can_eat_and_do_taxes in their program for each niche thing. Either situation is a lose-lose long term.
+class politician: public virtual person {
+ public:
+ void incomeGoesPublic() {
+ if (economicPopulist) {
+ if (getIncome() > 80000) {
+ publicApproval = publicApproval - 0.3;
+ if (publicApproval < 0.5) {
+ voters = voters - (voters * 0.4);
+ }
+ }
+ }
+ }
+ void setPublicApproval(float i) { publicApproval = i; }
+ void setVoters(int i) { voters = i; }
+ void setEconomicPopulist(bool i) { economicPopulist = i; }
+ float getPublicApproval() { return publicApproval;}
+ int getVoters() { return voters;}
+ bool getEconomicPopulist() { return economicPopulist;}
+ private:
+ float publicApproval;
+ int voters;
+ bool economicPopulist;
+
+};
+
+//Now here's where we get into "abomination" territory. Some ignorant intern or coding "genius" thinks it's clever to combine some classes together that are far from related to eachother. Maybe both it's because of the functionality both classes have or because they are "related" by some sick mockery of logic and reasoning. These are unfortunately real things that happen in real code bases and, once you get to this level of inheritance and abstration, the final product is far from resembaling the original classes that spawned the whole mess.
+//Just citing the examples you offered, and by no means this is not a dig at you, it's just an example of they type of mindset OOP programming puts people in, "Base class of video games, then 2 derived classes: 1 for mmo and 1 for fps, join class is reviews". Combining a MMO and an FPS conceptually does not give you a review, however, in code this may make absolute sense to do since they're just functions and variables and a review might need access to some data contained with both the FPS and MMO class.
+//At this level of abstraction, the notion that object orientated programming refers to "objects" falls aparts in favor of programmer convienence. This is overall harmful to a code base because it creates a misalignment between the intent of a programming paradigm and the actual results in the code. Programmers start by making objects that actually exist and are definable and they end by making "objects" that are either not objects at all, but rather a ball of functions and data, or very strange and tangently related objects that only connect to their parent objects in code, but not actual concept. More often than not, I find this makes it where I am fighting my tools just to do what I want to when dealing with OOP systems.
+
+//This example goes for the latter and preserves some of the "object" aspects of OOP. A political party is an object, it has politicians, and sorta acts like a company. It's not a good connection because a politicalParty is not a person, isn't a subvariant of either a politician or a company, and instead is its own thing with its own defined behavior in reality, however, a politicalParty, in this example, can pay taxes, can have lawyers, can have accountants, can have voters, can have public approval, can be economically populist, can be subject to tax rates, can take in income, and can be alive (or active). In pure code, this object makes sense, in reality, it does not.
+
+//This is the crux of the problem with OOP programming. In reality, it's really not object orientated because structures in code aren't objects and can never be objects. Computers preform tasks on data, so programming should be modeled in a fashion where this is at the front of a programmer's mind.
+//Computers cannot make objects. Objects are capable of being limitlessly applied and used in almost every context. I can take a real soda can and throw it, I can take a real soda can and drink it, and I can take a real soda can and shoot it into the sun. Computers are machines of data input, data processing, and data output that, at their root, use declarative operations to achieve these things. Nowhere in the structure of a computational machine is there a way to create an object that can be accessed and use in limitless ways. All possible activties must be declared before usage. This means that people are incentivized to not add unnecessary traits to the digital objects they create, at least until they drop the perception of OOP as object orientated and start viewing it as functions and data glued together again.
+//This makes OOP, when executed with objects in mind, a cruel mockery of actual objects that will always fall short either in the object's usability or due to out-of-scope, overengineering of an object into an uncomprehendable disaster. The scope of an object must go beyond a program's requirements to be a true object. Anything inherit must be a direct subclass of the object that inherits all aspects of its parent (such as a politician inheriting from a person). In computing, this is just not how the system works, so you end up fighting your tools if you adhere to OOP 100%.
+//When OOP is not executed with true objects in mind, it's just a bad way of grouping code and data together that makes life harder.
+
+class politicalParty: public politician, public company {
+ public:
+ void determinePoliticalStanding() {
+ if(getAlive()) {
+ if(getCorrupt()) {
+ cleverAccounting();
+ }
+
+ if(getTaxDelinquent()) {
+ setPublicApproval(getPublicApproval() - 0.3);
+ if (getPublicApproval() < 0.5) {
+ setVoters(getVoters() - (getVoters() * 0.4));
+ cardHoldingMembers = cardHoldingMembers - (cardHoldingMembers * 0.2);
+ }
+ }
+ incomeGoesPublic();
+
+ if (getOrganizationTaxableIncome() > 10000 && getTaxDelinquent()) {
+ setPublicApproval(getPublicApproval() - 0.2);
+ if (getPublicApproval() < 0.5) {
+ setVoters(getVoters() - (getVoters() * 0.4));
+ cardHoldingMembers = cardHoldingMembers - (cardHoldingMembers * 0.2);
+ }
+ }
+
+ if (getVoters() >= 10000 && cardHoldingMembers > 1000 && getPublicApproval() >= 0.5) {
+ currentlyHoldsOffice = true;
+ } else {
+ currentlyHoldsOffice = false;
+ }
+
+
+ } else {
+ currentlyHoldsOffice = false;
+ }
+
+ if (getCurrentlyHoldsOffice()) {
+ cout << "The political party " << getName() << " has won the election." << endl;
+ } else {
+ cout << "The political party " << getName() << " has lost the election." << endl;
+ }
+ cout << getName() << " had a total of " << getVoters() << " voters supporting it and an approval rating of " << getPublicApproval()*100 << "%\n";
+ }
+ void setCurrentlyHoldsOffice(bool i) { currentlyHoldsOffice = i; }
+ void setCorrupt(bool i) { corrupt = i; }
+ void setCardHoldingMembers(int i) { cardHoldingMembers = i; }
+ bool getCurrentlyHoldsOffice() { return currentlyHoldsOffice;}
+ bool getCorrupt() { return corrupt;}
+ int getCardHoldingMembers() { return cardHoldingMembers;}
+ private:
+ bool currentlyHoldsOffice;
+ bool corrupt;
+ int cardHoldingMembers;
+};
+
+
+politicalParty inputParty() {
+ politicalParty party;
+ string temp;
+
+
+ cout << "===Enter information about a political party===\n";
+ cout << "Is this party active? (y/n): ";
+ cin >> temp;
+ if(temp == "y" || temp == "Y") {
+ party.setAlive(true);
+ } else {
+ party.setAlive(false);
+ }
+
+ cout << "What is this party's name? ";
+ cin.ignore();
+ getline(cin, temp);
+ party.setName(temp);
+
+ cout << "What is this party's overall income? ";
+ cin >> temp;
+ party.setIncome(stof(temp));
+
+ cout << "Political parties in this country pay taxes.\n";
+ cout << "What is the tax rate the party is subject to (as a decimal-notation percentage)? ";
+ cin >> temp;
+ party.setTaxRate(stof(temp));
+
+ cout << "Does this political party have an accountant (y/n)? ";
+ cin >> temp;
+ if(temp == "y" || temp == "Y") {
+ party.setHasAccountant(true);
+ } else {
+ party.setHasAccountant(false);
+ }
+
+ cout << "Does this political party have a lawyer (y/n)? ";
+ cin >> temp;
+ if(temp == "y" || temp == "Y") {
+ party.setHasLawyer(true);
+ } else {
+ party.setHasLawyer(false);
+ }
+
+ cout << "Is this party's policy economically populist (y/n)? ";
+ cin >> temp;
+ if(temp == "y" || temp == "Y") {
+ party.setEconomicPopulist(true);
+ } else {
+ party.setEconomicPopulist(false);
+ }
+
+ cout << "Is this party politically corrupt(y/n)? ";
+ cin >> temp;
+ if(temp == "y" || temp == "Y") {
+ party.setCorrupt(true);
+ } else {
+ party.setCorrupt(false);
+ }
+
+ cout << "What is the current public approval rating of the party (as a decimal-notation percentage) (50 percent approval or higher is necessary to win)? ";
+ cin >> temp;
+ party.setPublicApproval(stof(temp));
+
+ cout << "How many people will be voting for this party? (10k are necessary to win) ";
+ cin >> temp;
+ party.setVoters(stoi(temp));
+
+ cout << "How many people are members of the party (1k are necessary to win) ";
+ cin >> temp;
+ party.setCardHoldingMembers(stoi(temp));
+
+ return party;
+}
+
+int main() {
+ politicalParty userParty = inputParty();
+ userParty.determinePoliticalStanding();
+}
+
+/*
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License Version 3 ONLY as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
diff --git a/C++/Multiple Inheritance/diamond.png b/C++/Multiple Inheritance/diamond.png
new file mode 100644
index 0000000..f6474e2
--- /dev/null
+++ b/C++/Multiple Inheritance/diamond.png
Binary files differ
diff --git a/C++/NestedLoop-TriangleDrawing/NestedLoop-TriangleDrawing.cpp b/C++/NestedLoop-TriangleDrawing/NestedLoop-TriangleDrawing.cpp
new file mode 100644
index 0000000..1ccb63a
--- /dev/null
+++ b/C++/NestedLoop-TriangleDrawing/NestedLoop-TriangleDrawing.cpp
@@ -0,0 +1,62 @@
+// Name: msglm
+// Date:
+// Program Name:
+// Description:
+
+
+#include <iostream>
+#include <string>
+#include <iomanip>
+using namespace std;
+
+// Named constants
+
+int main() {
+
+ //Variable declaration
+ int i;
+ int j;
+ int rows;
+
+ //Triangle 1
+ for ( i = 1; i <= 5; i++ ) {
+
+ for (j = 1; j <= i; j++)
+ cout << "*";
+ cout << endl;
+ }
+
+ //Triangle 2
+
+ for ( i = 5; i >= 1 ; i-- ) {
+ for (j = 1; j <= i ; j++ )
+ cout << "*";
+ cout << endl;
+ }
+
+ //Triangle 3
+ do {
+ cout << "Enter the number of rowsI (between 2 and 20): ";
+ cin >> rows;
+
+ if (rows < 2 || rows > 20)
+ cout << "Invalid input, try again!" << endl;
+
+ } while(rows < 2 || rows > 20);
+
+ for (i = 1; i <=rows; i++) {
+ for (j = 1; j<=i;j++)
+ cout << "*";
+ cout << endl;
+ }
+
+
+
+}
+
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/NewSummerJob/NewSummerJob.cpp b/C++/NewSummerJob/NewSummerJob.cpp
new file mode 100644
index 0000000..a88aadc
--- /dev/null
+++ b/C++/NewSummerJob/NewSummerJob.cpp
@@ -0,0 +1,84 @@
+// Name: msglm
+// Introduction: Summer Job Wage Calculator
+// Description: a program that calculates a weekly wage, based on an hourly payrate and how many hours were worked; then calculates amounts for various categories of spending, along with how much of the weekly pay is leftover.
+
+
+#include <iostream>
+#include <string>
+#include <iomanip>
+using namespace std;
+const double tax = 0.15;
+int main() {
+ //Rounding gets a bit gross when using floats, at the cost of memory, doubles are used.
+ string name;
+ double payRate;
+ double hours;
+ double WeeklyWage;
+ double shoppingPercent;
+ double entertainmentPercent;
+ double savingsPercent;
+ double remainder;
+
+ //Program Information
+ cout << "Name: Summer Job Wage Calculator \n";
+ cout << "Description: a program that calculates a weekly wage, based on an hourly payrate and how many hours were worked; then calculates amounts for various categories of spending, along with how much of the weekly pay is leftover.\n\n";
+
+ //Accept input via cin for hourly wages, pay rate, and name
+
+ //getline already in use, no need to change
+ cout << "What is your full name?: ";
+ getline(cin, name);
+
+ cout << "What is your payrate (per hour)?: ";
+ cin >> payRate;
+
+ cout << "How many hours have you worked?: ";
+ cin >> hours;
+
+ //Get the percentage variables
+
+ cout << "\n===NOTE: The following prompts do not need percentage symbols===\n";
+
+ cout << "How much would you like to allocate to shopping?\n";
+ cin >> shoppingPercent;
+
+ cout << "How much would you like to allocate to savings?\n";
+ cin >> savingsPercent;
+
+ cout << "How much would you like to allocate to entertainment?\n";
+ cin >> entertainmentPercent;
+
+ //Convert the input to percentages
+ shoppingPercent = shoppingPercent/100;
+ entertainmentPercent = entertainmentPercent/100;
+ savingsPercent = savingsPercent/100;
+
+
+ //Multiply the input to create the WeeklyWage variable
+ //Possible memory optimization here by removing the WeeklyWage variable, but at the cost of CPU cycles.
+ WeeklyWage = hours*payRate;
+
+ //Remainder will be its own var due to the more complex way to calculate it
+ remainder = WeeklyWage - WeeklyWage*(shoppingPercent+entertainmentPercent+savingsPercent+tax);
+
+ //have a bunch of cout statements that do all the math
+ // I.e : cout << “Tax: “ << WeeklyWage*tax
+
+ cout << fixed << setprecision(2);
+ cout << setw(15) << "Name:" << right << setw(5+name.length()) << name << endl;
+ cout << setw(15) << "Wages:" << right << setw(6) << "$" << WeeklyWage*tax << endl;
+ cout << setw(15) << "shopping:" << right << setw(6) << "$" << WeeklyWage*shoppingPercent << endl;
+ cout << setw(15) << "entertainment:" << right << setw(6) << "$" << WeeklyWage*entertainmentPercent << endl;
+ cout << setw(15) << "savings:" << right << setw(6) << "$" << WeeklyWage*savingsPercent << endl;
+ cout << setw(15) << "remainder:" << right << setw(6) << "$" << remainder << endl;
+
+ return 0;
+
+}
+
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/OOP/INSTRUCTIONS b/C++/OOP/INSTRUCTIONS
new file mode 100644
index 0000000..8c199c2
--- /dev/null
+++ b/C++/OOP/INSTRUCTIONS
@@ -0,0 +1,43 @@
+ Covert your Project 5 - Structs program to be object-oriented.
+Create a program that uses a class with array variables that do the following:
+
+ Get 3 sets of employee information for the below via the keyboard - no input file this time:
+ First Name
+ Last Name
+ Job Title
+ Employee Number
+ Hours Worked
+ Hourly Wage
+ Number of Deductions Claimed
+ Determine if the employee is entitled to overtime (see videos for explanation of overtime)
+ Determine tax rate based on deductions claimed (see videos for explanation of deductions)
+ Determine gross pay, taxes withheld, and netpay
+ Output all information to the screen, but only output overtime if the employee has it
+ Determine the highest and lowest paid employees. Output the name and salary of both
+
+Assignment Notes:
+
+ No structs please. Make your all of variables as private in the class to show me you understand how to do this
+ You may use vectors or array variables to store the employee data
+ You should not ask the user for their tax rate, gross pay, net pay, or taxes withheld. Your program should do this for the user.
+ I expect to see functions for steps 1 - 6 above
+
+General Notes:
+Be sure to use comments in your program: Name, Program Description, Date and anywhere else in the program you deem necessary.
+If you are stuck, I will help you!
+Grading Rubric:
+
+ If you do not include comments at the top of the program (name, program description, date), you will lose 15 points
+ If your program is not object-oriented, you will lose up to 80 points (OOP is the goal of this assignment)
+ If your program does not use functions, you will lose up to 60 points (depending on the number of functions missing)
+ If your program does not compile (run), then I will give a grade of 0/100. But will give you the change to repair for points back (some points are better than none)
+ If your program is late (within 48 hours of the due date), you will lose 25 points
+ If your program is late beyond the 48 hour due date, I will typically still accept it, but you will lose far more points. Depends on when you turn it in
+ If you use global variables in your program, I will deduct 5 points for each used
+ If your program is not formatted nicely (code all over the place, ugly), you will lose up to 25 points depending on the extent
+ If your program stops working when I run it, you will lose points. The exact amount depends on the severity of the error
+ If your program still has your friend's name on it, I will send you a message asking you to try harder while giving you a 0/100
+ If your program looks like a a professional programmer wrote it, I will write to you to ask if you want a job. Well, maybe not. But, I will ask about the code
+ This is just a list of typical issues I run into when grading to give you some idea of where your points go. Points can be taken off for other reasons.
+
+
diff --git a/C++/OOP/OOP.cpp b/C++/OOP/OOP.cpp
new file mode 100644
index 0000000..76d5735
--- /dev/null
+++ b/C++/OOP/OOP.cpp
@@ -0,0 +1,205 @@
+// Name: msglm
+// Date: Sep 29th, 2022
+// Program Name: Structs
+// Description: Given an input file, output gross pay, taxes, net pay, and other financial information.
+
+#include <iostream>
+#include <fstream>
+#include <string>
+using namespace std;
+
+
+//Classes
+class Employee {
+ private: //Hiding data from a programmer is like hiding pipes from a plumber
+ string fname;
+ string lname;
+ string job;
+ int employeeNum;
+ float hrsWorked;
+ float wage;
+ int deductions;
+ public:
+
+ //Lines and lines of the same thing
+ //I'm a stickler for verbosity in code, but this is just too far
+ //Brings me back to my Java days
+
+ void set_fname(string input) {
+ fname = input;
+ }
+ string get_fname() {
+ return fname;
+ }
+
+ void set_lname(string input) {
+ lname = input;
+ }
+ string get_lname() {
+ return lname;
+ }
+
+ void set_job(string input) {
+ job = input;
+ }
+ string get_job() {
+ return job;
+ }
+
+ void set_employeeNum(int input) {
+ employeeNum = input;
+ }
+ int get_employeeNum() {
+ return employeeNum;
+ }
+
+ void set_hrsWorked(float input) {
+ hrsWorked = input;
+ }
+ float get_hrsWorked() {
+ return hrsWorked;
+ }
+
+ void set_wage(float input) {
+ wage = input;
+ }
+ float get_wage() {
+ return wage;
+ }
+
+ void set_deductions(int input) {
+ deductions = input;
+ }
+ int get_deductions() {
+ return deductions;
+ }
+
+
+};
+
+
+//Takes in the initalized file and puts it into an object instance
+Employee serializeIntoObj() {
+ Employee employee;
+ string temp;
+
+ //Probably the worst thing I've ever wrote
+ //however, I am running out of time on this assignment
+ //and it "just werks"
+ //
+ //I love fighting against my tools to do what I want
+ //"cin" has to be special and have its own little istream type
+ //instead of just being a function that, upon reaching a
+ //terminating character returns a string or a char[].
+ //
+ //but hey, it could be worse, I could be dealing with the
+ //trainwreck that is BOOST
+
+ cout << "===Enter your information===\n";
+ cout << "Please enter your first name: ";
+ cin >> temp;
+ employee.set_fname(temp);
+ cout << "Please enter your last name: ";
+ cin >> temp;
+ employee.set_lname(temp);
+ cout << "Please enter your job title: ";
+ cin >> temp;
+ employee.set_job(temp);
+ cout << "Please enter your employee ID: ";
+ cin >> temp;
+ employee.set_employeeNum(stoi(temp));
+ cout << "Please enter your number of hours worked: ";
+ cin >> temp;
+ employee.set_hrsWorked(stof(temp));
+ cout << "Please enter your wage: ";
+ cin >> temp;
+ employee.set_wage(stof(temp));
+ cout << "Please enter your number of deductions: ";
+ cin >> temp;
+ employee.set_deductions(stoi(temp));
+ return employee;
+}
+
+//given hours work, return the amount of overtime.
+float overtime(Employee employee) {
+ if (employee.get_hrsWorked() > 40) {
+ float oTHours = employee.get_hrsWorked() - 40;
+ if (oTHours > 0) {
+ return oTHours;
+ }
+ }
+ return 0;
+}
+
+//Given the deductions, return the taxrate
+float taxRate(Employee employee) {
+ if (employee.get_deductions() <= 0) {
+ return 0.30;
+ } else if (0.30-(employee.get_deductions()*0.05) <= 0.10) {
+ return 0.10;
+ } else {
+ return 0.30-(employee.get_deductions()*0.05);
+ }
+}
+
+//Intake the employee in question, his overtime, and then the tax rate he's subject to
+//
+void outputGrossTaxPay(Employee employee, float overtime, float taxRate) {
+
+ float overtimePay = overtime*(employee.get_wage()*1.5);
+ float normalPay;
+ if (overtime > 0) {
+ normalPay = employee.get_wage()*40;
+ } else {
+ normalPay = employee.get_wage()*employee.get_hrsWorked();
+ }
+ float grossPay = overtimePay + normalPay;
+ float withheld = taxRate*grossPay;
+ cout << "Employee Name: " << employee.get_fname() << " " << employee.get_lname() << endl;
+ cout << "Job Title: " << employee.get_job() << endl;
+ cout << "Employee Number: " << employee.get_employeeNum() << endl;
+ cout << "Hours Worked: " << employee.get_hrsWorked() << endl;
+ cout << "Hourly Wage: $" << employee.get_wage() << endl;
+ cout << "Deductions Claimed: " << employee.get_deductions() << endl;
+ if (overtime > 0) {
+ cout << "Overtime Hours: " << overtime << endl;
+ cout << "Overtime Pay: $" << overtimePay << endl;
+ }
+ cout << "Gross Pay: $" << grossPay << endl;
+ cout << "Tax Withheld: $" << withheld << endl;
+ cout << "Net Pay: $" << grossPay-withheld << endl;
+
+
+
+}
+
+int main() {
+
+ //Variable declaration
+ const int ARR_SIZE = 3;
+ Employee readValues[ARR_SIZE];
+
+
+ //Collect the data
+ for (int employeePos=0; employeePos < ARR_SIZE; employeePos++) {
+ readValues[employeePos] = serializeIntoObj();
+ }
+ //Present the data
+ for (int employeePos=0; employeePos < ARR_SIZE; employeePos++) {
+ cout << "===New Employee==\n";
+ outputGrossTaxPay(readValues[employeePos], overtime(readValues[employeePos]), taxRate(readValues[employeePos]));
+ }
+
+
+
+
+
+}
+
+/*
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License Version 3 ONLY as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
diff --git a/C++/ParallelArray/ParallelArray.cpp b/C++/ParallelArray/ParallelArray.cpp
new file mode 100644
index 0000000..b859023
--- /dev/null
+++ b/C++/ParallelArray/ParallelArray.cpp
@@ -0,0 +1,53 @@
+// Name: msglm
+// Date:
+// Program Name:
+// Description:
+
+
+#include <iostream>
+#include <string>
+#include <iomanip>
+using namespace std;
+
+// Named constants
+const int ARRAY_SIZE = 5;
+
+int main() {
+
+ //Variable declaration
+ string name[ARRAY_SIZE];
+ int age[ARRAY_SIZE];
+
+ //Program title and description for the user
+ cout << "parallel array example " << endl << endl;
+ cout << "This program shows the example of parallel arrays. arrays can\n only hold data of one type. so if you want to store something\n like names and ages you must store then in different arrays\n\n this program will ask for 5 names and their corresponding\n ages and then output the results in columns " << endl << endl;
+
+ //User input
+ for(int i = 0; i < ARRAY_SIZE; i++) {
+ cout << "Enter a name: ";
+ getline(cin, name[i]);
+ cout << "Enter the age: ";
+ cin >> age[i];
+
+ cin.ignore(); //ignores newln char after age before begin of name
+ }
+
+
+ //output
+
+ //headlines
+ cout << "\033[2J\033[1;1H";
+ cout << setw(20) << left << "Name" << setw(4) << right << "Age" << endl;
+
+ //names/ages
+ for (int i = 0; i < ARRAY_SIZE; i++) {
+ cout << setw(20) << left << name[i] << setw(4) << right << age[i] << endl;
+ }
+}
+
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/Pointers/Pointers.cpp b/C++/Pointers/Pointers.cpp
new file mode 100644
index 0000000..44a46a1
--- /dev/null
+++ b/C++/Pointers/Pointers.cpp
@@ -0,0 +1,87 @@
+// Name: msglm
+// Date: Oct 26th 2022
+// Work Name: Pointers
+// Description: an experiment in bad solutions to bad problems (but much more forgivable than other solutions)
+
+
+////What is a pointer?
+//Pointers are variables whos entire job is to point to another location of memory.
+
+////What are advantanges of using pointers in our programs?
+//Pointers are great for causing side effects in your program, especially for dealing with IO issues. For example, I often create an ifstream variable and pass it by reference to a function that deals with the boilerplate initalization code.
+//
+//Pointers also tend to be used in advanced data structures like linked-lists, double linked-lists.
+//
+//Pointers can also be used for dynamic memory allocation
+//
+//Pointers are also amazing at digging out security holes, if you're interested in doing that for some reason. This is because humans are notoriously terrible at keeping track of things and tend to destroy things that shouldn't ne or forget to destroy things when they should.
+//Because of this problem, humans invented the garbage collector, a program that automatically deals with that for people. This removes nasty pointer issue from your life, but at the cost of CPU cycles.
+//Sometimes, that just wont cut it. No one wants to waste CPU cycles checking if something should be freed when they're running an Operating System, so people start to bring back the pointer and all of it's lovely security flaws and segmentation faults that come with it.
+//Then, one day, someone invented the "Borrow Checker", a tool to help programmers ensure memory safety while still being able to use pointers.
+//However, like anything shiny, new, and modern, it's actually a hellish and complex ploy made to distract man from the one true programming paradigm that would save us all from dangling pointer hell: Stack-orientated programming.
+//That's right, FORTH is the solution to all problems, boot up a copy of CollapseOS (http://collapseos.org/) and start programming on the stack!
+//
+//jokes aside, all solutions to this problem are horrible. Garbage collection and stack-based programming seems to be the least bad, but both are still awful. Garbage collection is SLOW. Borrow checkers or code pre-processors may be the true solution in the long run, but borrow checkers are their own complex beasts of rules and pain. On top of that, the only real "borrow checker" language is Rust and Rust's syntax somehow makes me appreciate Java.
+
+
+////How have we been using pointers in our programs already?
+//Pass-by-reference may be consdiered the use of pointers, however, references are the constants of the pointer world and are different enough that most people consdier them incopatable, however, it's the closest the class has gotten so far.
+
+////Name and describe three differences between references and pointers
+// 1. References are may not be reassigned upon being created
+// 2. References must reference an datum already in existance
+// 3. References cannot ever be NULL
+
+//Write a short program demonstrating how pointers work (use at least one function please and no copy/paste from any source, make up your own program based on what you read)
+
+
+// Name: msglm
+// Date: Oct 26th 2022
+// Work Name: Truth-To-Lies
+// Description: Using pointer arithmatic and other dark magic, turn a truthful statement into a lie.
+
+#include <iostream>
+#include <string>
+using namespace std;
+
+int main() {
+
+char text[] = "Pointers are a security disaster, borrow checkers are way too complex, garbage collection is slow, and stack-orientated programming is too limited, but all these problems are merely hetrodoxical qubbling when compared to the heathenry that is OOP and its inheretence disaster.";
+char *pointerText;
+
+pointerText = text;
+
+pointerText = pointerText + 1;
+cout << *pointerText;
+pointerText = pointerText + 34;
+cout << *pointerText;
+pointerText = pointerText + 30;
+cout << *pointerText;
+pointerText = pointerText + 5;
+cout << *pointerText;
+pointerText = pointerText + 16;
+cout << *pointerText;
+pointerText = pointerText + 5;
+cout << *pointerText;
+pointerText = pointerText + 28;
+cout << *pointerText;
+pointerText = pointerText + 4;
+cout << *pointerText;
+pointerText = pointerText + 1;
+cout << *pointerText;
+pointerText = pointerText + 34;
+cout << *pointerText;
+pointerText = pointerText + 13;
+cout << *pointerText;
+pointerText = pointerText + 13;
+cout << *pointerText;
+cout << "!" << endl;
+
+}
+/*
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License Version 3 ONLY as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
diff --git a/C++/Polymorphism/INSTRUCTIONS b/C++/Polymorphism/INSTRUCTIONS
new file mode 100644
index 0000000..87fad1e
--- /dev/null
+++ b/C++/Polymorphism/INSTRUCTIONS
@@ -0,0 +1,47 @@
+**NOTE** You are free to write a non-trivial program of your choice that demonstrates polymorphism (runtime or compile time or both). Or, if you cannot think of your own program idea, you may complete the below program. It is payroll again, so I wanted to give you an option to do something different so you don't become bored.
+If you choose to use this program, then below are criteria:
+Write a program that does the following:
+
+ Create a class called Employee and it will store variables for first name, last name, hours worked, wage, gross pay, net pay, tax, overtime wage, overtime pay, overtime hours, and deductions
+ Get data via the keyboard or from an input file for first name, last name, wage, hours worked and deductions. The remaining varaibles are derived values
+ To demonstrate polymorphism, you will have two functions with the same name: payroll. The payroll functions will do all calculations. Except, one function will be for a manager (salaried employee) and one function will be for hourly employees
+ For further polymorphism practice, you will have two functions with the same name: output. These output functions will output all payroll information. One function will output manager information and one will output all hourly employee information
+
+Assignment Notes for the payroll program:
+
+ Make variables either arrays or vectors - your choice
+ Don't forget to check for overtime!
+ Only output overtime for hourly employees if it exists
+ Managers do not have overtime since they are salaried. The get the same paycheck each pay period, so do not look for overtime for them.
+ If you want, you can output all information to an output file instead of the screen. Depending on how you write this program, this may make your program easier.
+
+Assignment Notes for custom program:
+
+ Make variables either arrays or vectors - your choice
+ Your program must have at least two classes
+ Each class must have at least two non-trivial functions
+ You must demonstrate run time or compile time (or both!) polymorphism in your program
+ If you are not sure what to write and do not want another payroll program, try modifying your project 9 so that it uses polymorphism! Then, most of the program is written already
+
+General Notes:
+Be sure to use comments in your program: Name, Program Description, Date and anywhere else in the program you deem necessary.
+If you are stuck, I will help you!
+Grading Rubric:
+
+ If you do not include comments at the top of the program (name, program description, date), you will lose 15 points
+ If your program is not object-oriented, you will receive a 0/100 (OOP is requred for this assignment)
+ If your program does not use functions, you will lose up to 75 points (depending on the number of functions missing)
+ If your program does not use polymorphism, you will lose up to 100 points since this is the point of the assignment
+ If your program does not compile (run), then I will give a grade of 0/100. But will give you the change to repair for points back (some points are better than none)
+ If your program is late (within 48 hours of the due date), you will lose 25 points
+ If your program is late beyond the 48 hour due date, I will typically still accept it, but you will lose far more points. Depends on when you turn it in
+ If you use global variables in your program, I will deduct 5 points for each used
+ If your program is not formatted nicely (code all over the place, ugly), you will lose up to 25 points depending on the extent
+ If your program stops working when I run it, you will lose points. The exact amount depends on the severity of the error
+ If your program still has your friend's name on it, I will send you a message asking you to try harder while giving you a 0/100
+ If you submit a file type I cannot open, such as .sln, you will receive a 0/100. You will be able to resubmit for credit, but you will lose up to 90 points (depending on how late it is)
+ If your program looks like a a professional programmer wrote it, I will write to you to ask if you want a job. Well, maybe not. But, I will ask about the code
+ This is just a list of typical issues I run into when grading to give you some idea of where your points go. Points can be taken off for other reasons.
+
+
+
diff --git a/C++/Polymorphism/Polymorphism.cpp b/C++/Polymorphism/Polymorphism.cpp
new file mode 100644
index 0000000..d09c2d6
--- /dev/null
+++ b/C++/Polymorphism/Polymorphism.cpp
@@ -0,0 +1,155 @@
+// Name: msglm
+// Date: Nov-14th-2022
+// Program Name: parse CSV
+// Description: parses a character-seperated value sequence. Not very robust.
+
+//This program is a bit less barebones and cool than I wanted, that's because, while working on the original project, I noticed my GPU fan had gone out
+//and that I have been risking overheating my computer. I promptly ceased using my computer and repaired the device. This was about 50% of the way through
+//completing the program. By the time I had the thing fixed, I was working on borrowed time and opted to scrap the original project for something more simple.
+//
+//The project in question was a small, tile-based territorial control game where AI would battle it out for control over the whole board. I had a good portion of it done, but
+//still a lot more to get done. Once I got my GPU back in, I saw how much was necessary, and ditched the whole project because of time constraints.
+//
+//Lesson learned: never do cool things when under a deadline.
+
+#include <iostream>
+#include <string>
+#include <fstream>
+using namespace std;
+
+class parseCSV {
+ public:
+ string input;
+ char delim;
+ string processed;
+
+ void setdelim(char x) {
+ delim = x;
+ }
+
+ void setdelim(string x) {
+ delim = x[0];
+ }
+
+ void takeInput() {
+ cout << "Please enter the data that you would like to be parsed\n";
+ cin >> input;
+ }
+
+ void takeInput(string toParse) {
+ input = toParse;
+ }
+
+ void takeInput(ifstream & file) {
+
+ file.open("input.txt");
+ if (!file) {
+ cout << "ERROR! input.txt does not exist!";
+ exit(1);
+ }
+ getline(file, input);
+ file.close();
+ }
+
+ void process() {
+ for(int charPos = 0; charPos < input.length(); charPos++) {
+ if (input.at(charPos) == delim) {
+ processed.push_back('\n');
+ } else {
+ processed.push_back(input[charPos]);
+ }
+ }
+
+ }
+
+ void output() {
+ cout << processed;
+ }
+
+ void output(string location) {
+ ofstream output;
+ output.open(location);
+ output << processed;
+ output.close();
+ }
+
+};
+
+
+int main() {
+
+ parseCSV parse;
+ int choice;
+
+ //Taking in the data to be parsed
+ cout << "Would you like too...\n";
+ cout << "1. Read input from a file\n";
+ cout << "2. Input data manually\n";
+ cout << "Enter Selection: ";
+ cin >> choice;
+
+ switch (choice) {
+ case 1:
+ {
+ ifstream file;
+ parse.takeInput(file);
+ break;
+ }
+ case 2:
+ {
+ parse.takeInput();
+ break;
+ }
+ default:
+ cout << "You did not give a valid input. Exiting.";
+ exit(1);
+ break;
+ }
+
+ //Setting the deliminator
+ char temp;
+ cout << "Please selecte a deliminator for your file: ";
+ cin >> temp;
+ parse.setdelim(temp);
+
+ //process the input
+ parse.process();
+
+ //Outputting
+ cout << "Would you like too...\n";
+ cout << "1. Have the output put in a file\n";
+ cout << "2. Have the output put on the screen\n";
+ cout << "Enter Selection: ";
+ cin >> choice;
+
+ switch (choice) {
+ case 1:
+ {
+ string temploc;
+ cout << "Where would you like to write the file?\n";
+ cin >> temploc;
+ parse.output(temploc);
+ break;
+ }
+ case 2:
+ {
+ parse.output();
+ break;
+ }
+ default:
+ {
+ cout << "You did not give a valid input. Exiting.";
+ exit(1);
+ break;
+ }
+ }
+
+
+}
+/*
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License Version 3 ONLY as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
diff --git a/C++/Polymorphism/PolymorphismTooCool.cpp b/C++/Polymorphism/PolymorphismTooCool.cpp
new file mode 100644
index 0000000..472817b
--- /dev/null
+++ b/C++/Polymorphism/PolymorphismTooCool.cpp
@@ -0,0 +1,205 @@
+// Name: msglm
+// Date: Nov-13-2022
+// Program Name: Brutal Geo-politics
+// Description: A civlization game with econoimcs and power where the goal is to take every tile on the board. This version is played by the AI
+
+
+#include <iostream>
+#include <string>
+#include <array>
+#include <random>
+#include <vector>
+
+using namespace std;
+
+//classes
+class civilization {
+ public:
+ //icon will represent the civilization on the map
+ char icon;
+ //aggressiveness will represent how likely a civilization is to
+ //aquire territory by stealing it rather than buying it.
+ //higher = more likely to steal; lower = more likely to buy.
+
+ ///AXED DUE TO TIME CONSTRAINTS
+ //This will control the AI for the civilizations
+ //float aggressiveness;
+
+ //resources that each civlization has
+ int manpower;
+ int money;
+
+ //The percentage of the economicOutput a civilization will take per turn from each of its territories.
+ float taxRate;
+
+ void quasiConstructor(default_random_engine & randNumGen, char chosenIcon) {
+ icon = chosenIcon;
+
+ uniform_real_distribution<float> percent(0.0,1.0);
+ aggressiveness = percent(randNumGen);
+ taxRate = percent(randNumGen);
+ }
+
+};
+
+//structs
+class tile {
+ public:
+ //The current owner of a civilization
+ civilization owner;
+
+ //Dictates how much manpower is in a tile
+ int manpower;
+ float populationGrowth;
+ //Compliance of a tile is how docile a tile is towards its master civilization
+ //Compliance will lower if the master civilization is out of money or out of manpower
+ //Compliance will also lower if taxes are too high (see economicOutputExpectation)
+ //If compliance reaches zero, a revolt will happen and the current tile will become its own civilization
+ int compliance;
+
+
+ //The raw value of the tile; this amount of money will need to be exchanged to take a tile by purchasing
+ int value;
+
+ //The value, per turn, the tile generates.
+ //If nobody owns the tile, the value of the tile will simply go up
+ //If someone does own this tile, a percentage of that tile's economicOutput will be collected
+ //by the master civilization in accordance with their tax rate.
+ float economicOutput;
+
+ //The percentage of economicOutput a tile expects to keep
+ //If a tax rate goes over this amount, a tile will lower in its compliance.
+ float economicOutputExpectation;
+
+ //If a tile is a core tile, it will never revolt.
+ //This status is reserved for the starting point of a civilization (the capital) or tiles that have been
+ //annhilated after failing to revolt.
+ bool coreTile;
+
+ //If this tile is a wilderness tile, it has never been contacted by a civilization.
+ //This means no one owns it and civilizations cannot be spawned out of them (except during game start).
+ bool wilderness;
+
+ //From my research, there is no good way to pass
+ //parameters to a constructor function that belongs to an object
+ //that's inside of an array.
+ //Because of this, the following function must be called after the object it initalized
+ //to be able to use a universal random number generator that doesn't involve global variables.
+ //I would use global variables, but I also want points, so instead we get this:
+ void quasiConstructor( default_random_engine & randNumGen ) { //Pass by reference because, in this instance for maximum performance
+ wilderness = true;
+
+ uniform_int_distribution<int> manpowerRange(1,100000);
+ manpower = manpowerRange(randNumGen);
+
+ uniform_real_distribution<float> populationGrowthRange(0.0,0.9);
+ populationGrowth = populationGrowthRange(randNumGen);
+
+ uniform_int_distribution<int> economicOutputRange(1,15000);
+ economicOutput = economicOutputRange(randNumGen);
+
+ value = economicOutput;
+
+ uniform_real_distribution<float> economicOutputExpectationRange(0.0,0.9);
+ economicOutputExpectation = economicOutputExpectationRange(randNumGen);
+ }
+
+ void claim(civilization claimant) {
+ if (wilderness) {
+ owner = claimant;
+ wilderness = false;
+ }
+
+ }
+ void popGrowth() { manpower = manpower + (populationGrowth*manpower); }
+ //Revolt will succeed if the manpower of a tile is greater than 10% of its master's manpower
+ //OR
+ //if the economic value of a tile is greater than 10% of its master's money
+ //if neither of these conditions are the case and the revolt fails, the tile's population will be evicerated and the tile
+ //will becomine a coreTile, unable to revolt ever again.
+ void revolt() {}
+
+};
+
+//functions
+
+
+//TODO: figure out a way to pass the board without hard-coding 64 as the array size
+//and without using a vector (because vectors are bloat).
+//"declaration of ‘board’ as multidimensional array must have bounds for all dimensions except the first"
+//there is literally zero reason for this to be the case and gives further reasoning to deprecate C/C++.
+void printBoard(tile board[][64], unsigned int boardsize) {
+ for(int xpos=0; xpos < boardsize; xpos++) {
+ cout << endl;
+ for (int ypos = 0; ypos < boardsize; ypos++) {
+ if (board[xpos][ypos].wilderness) {
+ cout << ".";
+ } else {
+ cout << board[xpos][ypos].owner.icon;
+ }
+ }
+ }
+}
+
+
+int main() {
+
+ //Create the board and all its glory
+ const unsigned int SIZE = 64;
+ const unsigned int CIVAMOUNT = 4;
+ bool gameGoing;
+ char winner;
+ random_device rd;
+ default_random_engine randNumGen(rd());
+ tile playingBoard[SIZE][SIZE];
+ for(int xpos = 0; xpos < SIZE; xpos++) {
+ for (int ypos = 0; ypos < SIZE; ypos++) {
+ playingBoard[xpos][ypos].quasiConstructor(randNumGen);
+ }
+ }
+
+ //Spawning some civilizations
+
+ //this gets to be a vector due to the stack-based situation civilizations will exist in
+ //civlizations can be born or die at a whim, they need to be able to be added to a stack as well.
+ vector<civilization> civlist;
+ uniform_int_distribution<int> randomSpot(0,SIZE);
+
+ //TODO make this create CIVAMOUNT of civilizations, each with a random char representing it
+ civlist.push_back(civilization());
+ civlist.back().quasiConstructor(randNumGen, 'R');
+ playingBoard[randomSpot(randNumGen)][randomSpot(randNumGen)].claim(civlist.back());
+
+ civlist.push_back(civilization());
+ civlist.back().quasiConstructor(randNumGen, 'U');
+ playingBoard[randomSpot(randNumGen)][randomSpot(randNumGen)].claim(civlist.back());
+
+ civlist.push_back(civilization());
+ civlist.back().quasiConstructor(randNumGen, 'J');
+ playingBoard[randomSpot(randNumGen)][randomSpot(randNumGen)].claim(civlist.back());
+
+ //Turn system
+
+ while (gameGoing) {
+ for(civilization civ : civilist) {
+
+ }
+
+ }
+ }
+
+
+ //Check for win condition (3 turns where every tile is owned by one civ)
+
+ //output each turn to a file
+ printBoard(playingBoard, SIZE);
+
+}
+
+/*
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License Version 3 ONLY as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
diff --git a/C++/Polymorphism/input.txt b/C++/Polymorphism/input.txt
new file mode 100644
index 0000000..3f8c45d
--- /dev/null
+++ b/C++/Polymorphism/input.txt
@@ -0,0 +1 @@
+test,test,test
diff --git a/C++/Rectangle/Rectangle.cpp b/C++/Rectangle/Rectangle.cpp
new file mode 100644
index 0000000..537d44b
--- /dev/null
+++ b/C++/Rectangle/Rectangle.cpp
@@ -0,0 +1,33 @@
+// Name: msglm
+// Introduction: Rectangle Program
+// Description: Program to compute and output the perimeter and area of a rectangle.
+
+
+#include <iostream>
+using namespace std;
+int main() {
+ double length;
+ double width;
+ double area;
+ double perimeter;
+ cout << "Program to compute and output the perimeter and "
+ << "area of a rectangle." <<endl;
+ length = 6.0;
+ width = 4.0;
+
+ perimeter = 2*(length+width);
+
+ area = length*width;
+ cout << "length = " << length << endl;
+ cout << "width = " << width << endl;
+ cout << "perimeter = " << perimeter << endl;
+ cout << "area = " << area << endl;
+ return 0;
+}
+
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/RestaurantBill/RestaurantBill.cpp b/C++/RestaurantBill/RestaurantBill.cpp
new file mode 100644
index 0000000..cdcc40d
--- /dev/null
+++ b/C++/RestaurantBill/RestaurantBill.cpp
@@ -0,0 +1,55 @@
+// Name: msglm
+// Introduction: Restaurant Bill Calculator
+// Description: Calculates Food Bill Plus Tip and Tax.
+
+
+#include <iostream>
+using namespace std;
+int main() {
+
+ float foodBill;
+ char tipChoice;
+
+ cout << "How much did your meal cost?: ";
+ cin >> foodBill;
+
+ cout << "A. 10% - " << foodBill+(foodBill*0.10) << endl;
+ cout << "B. 15% - " << foodBill+(foodBill*0.15) << endl;
+ cout << "C. 20% - " << foodBill+(foodBill*0.20) << endl;
+ cout << "Select a Letter (case-sensitive) to pick your tipping amount: ";
+ cin >> tipChoice;
+
+ switch(tipChoice){
+ case 'A':
+ cout << "You Owe: \n"
+ << "Before Tax and Before Tip: " << foodBill << endl
+ << "After Tax and Before Tip: " << foodBill+(foodBill*0.095) << endl
+ << "After Tax and After Tip: " << foodBill+(foodBill*0.10) + (foodBill*0.095) << endl;
+ break;
+ case 'B':
+ cout << "You Owe: \n"
+ << "Before Tax and Before Tip: " << foodBill << endl
+ << "After Tax and Before Tip: " << foodBill+(foodBill*0.095) << endl
+ << "After Tax and After Tip: " << foodBill+(foodBill*0.15) + (foodBill*0.095) << endl;
+ break;
+ case 'C':
+ cout << "You Owe: \n"
+ << "Before Tax and Before Tip: " << foodBill << endl
+ << "After Tax and Before Tip: " << foodBill+(foodBill*0.095) << endl
+ << "After Tax and After Tip: " << foodBill+(foodBill*0.20) + (foodBill*0.095) << endl;
+ break;
+ default:
+ cout << "You didn't input the right letter. Remember, the letters were capitalized.";
+ return 1;
+
+ }
+ return 0;
+
+}
+
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/Sales Array Program/.~lock.Ch 8 Sales Array Program.docx# b/C++/Sales Array Program/.~lock.Ch 8 Sales Array Program.docx#
new file mode 100644
index 0000000..73e693a
--- /dev/null
+++ b/C++/Sales Array Program/.~lock.Ch 8 Sales Array Program.docx#
@@ -0,0 +1 @@
+,msglm,msglm-desktop,21.04.2022 00:33,file:///home/msglm/.config/libreoffice/4; \ No newline at end of file
diff --git a/C++/Sales Array Program/Ch 8 Sales Array Program.docx b/C++/Sales Array Program/Ch 8 Sales Array Program.docx
new file mode 100644
index 0000000..bb0f1ca
--- /dev/null
+++ b/C++/Sales Array Program/Ch 8 Sales Array Program.docx
Binary files differ
diff --git a/C++/Sales Array Program/SalesArrayProgram.cpp b/C++/Sales Array Program/SalesArrayProgram.cpp
new file mode 100644
index 0000000..6cd5e766
--- /dev/null
+++ b/C++/Sales Array Program/SalesArrayProgram.cpp
@@ -0,0 +1,94 @@
+// Name: msglm
+// Date:
+// Program Name:
+// Description:
+
+
+#include <iostream>
+#include <string>
+#include <iomanip>
+#include <fstream>
+using namespace std;
+
+// Named constants
+const int ARRAY_SIZE = 7;
+
+//Func Decl
+void printDailySales(double array[]);
+double findTotal(double array[]);
+double findMax(double array[]);
+double findMin(double array[]);
+
+int main() {
+
+ //Variable declaration
+ ifstream salesFile;
+ double readSales[ARRAY_SIZE];
+
+ //Open file
+ salesFile.open("daily_sales.txt");
+
+ //Program title and description for the user
+ cout << "Title: 7-day sales calculator" << endl << "Description: Takes in a file with the total income for a day segregated by a newline character. Output is a breakdown of each day's sales, the total for the week, the worst day, and the best day." << endl;
+
+ //Reading input
+ for (int pos = 0; pos < ARRAY_SIZE; pos++) {
+ salesFile >> readSales[pos];
+ }
+
+ //Output
+ printDailySales(readSales);
+ cout << "Total: $" << findTotal(readSales) << endl;
+ cout << "Max: $" << findMax(readSales) << endl;
+ cout << "Min: $" << findMin(readSales) << endl;
+ return 0;
+}
+
+//Prints the daily sales
+void printDailySales(double array[]) {
+ cout << "Daily Sales Earned: \n";
+ for (int pos = 0; pos < ARRAY_SIZE; pos++) {
+ cout << "Day #" << pos+1 << ": $" << array[pos] << endl;
+ }
+}
+
+//Adds up total and returns it as a sum
+double findTotal(double array[]){
+ double sum = 0;
+ for (int pos = 0; pos < ARRAY_SIZE; pos++) {
+ sum = sum + array[pos];
+ }
+ return sum;
+}
+
+//Just a classic "find maximum" sorting algorithm
+double findMax(double array[]){
+ double max = array[0];
+ for (int pos = 1; pos < ARRAY_SIZE; pos++) {
+ if (max < array[pos]) {
+ max = array[pos];
+ }
+ }
+ return max;
+}
+
+//classic find minimum sorting algorithm
+double findMin(double array[]){
+ double min = array[0];
+ for (int pos = 1; pos < ARRAY_SIZE; pos++) {
+ if (min > array[pos]) {
+ min = array[pos];
+ }
+ }
+ return min;
+}
+
+
+
+
+ /*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/Sales Array Program/daily_sales.txt b/C++/Sales Array Program/daily_sales.txt
new file mode 100644
index 0000000..9631979
--- /dev/null
+++ b/C++/Sales Array Program/daily_sales.txt
@@ -0,0 +1,7 @@
+352.12
+654.84
+123.45
+654.87
+548.26
+532.56
+456.13
diff --git a/C++/SortArrayExample1/SortArrayTemplate1.cpp b/C++/SortArrayExample1/SortArrayTemplate1.cpp
new file mode 100644
index 0000000..2d13d65
--- /dev/null
+++ b/C++/SortArrayExample1/SortArrayTemplate1.cpp
@@ -0,0 +1,71 @@
+// Sort Array Example
+// Ch 8
+/*
+The selection sort algorithm rearranges a list by selecting an element in the list and moving it
+to its proper position. This algorithm finds the location of the smallest element in the unsorted
+portion of the list and moves it to the top of the unsorted portion of the list. The first time,
+we locate the smallest item in the entire list. The second time, we locate the smallest item in
+the list starting from the second element in the list, and so on.
+*/
+
+#include <iostream>
+
+using namespace std;
+
+// Constant declarations
+const int ARRAY_SIZE = 8;
+
+int main()
+{
+ // Variable declarations
+ int list[ARRAY_SIZE] = {16, 30, 24, 7, 62, 45, 5, 55};
+ int smallestIndex;
+ int temp;
+ // Program title and description
+ cout << "Selection Sort Example" << endl << endl;
+
+ // Output original unsorted array
+ for ( int i = 0; i < ARRAY_SIZE; i++) {
+ cout << list[i] << endl;
+ }
+ cout << endl;
+
+ // Outer FOR loop controls current location of the smallest index
+ // notice that you iterate to one LESS than the array size
+
+ for ( int i = 0; i < ARRAY_SIZE - 1; i++ ) {
+
+
+
+
+ smallestIndex = i; // Find the location of the smallest element
+ // sets smallest value to first item in array
+ // Inner FOR loop iterates through the array to compare two values
+
+ for (int currentLocation = i+1; currentLocation < ARRAY_SIZE; currentLocation++) {
+ // ...if the current value is less than the current smallest value...
+ if (list[currentLocation] < list[smallestIndex]) {
+ // ...then set the smallest value to the current value
+ smallestIndex = currentLocation;
+ }
+ }
+
+ // Move the smallest element to the beginning of the unsorted list - note 3 variables needed
+
+ temp = list[smallestIndex];
+ list[smallestIndex] = list[i];
+ list[i] = temp;
+ }
+
+ // Output sorted array
+
+ cout << "Sorted Array: " << endl;
+ for ( int i = 0; i < ARRAY_SIZE; i++) {
+ cout << list[i] << endl;
+ }
+ cout << endl;
+
+
+
+ return 0;
+}
diff --git a/C++/SortArrayExample2/SortArrayTemplate2.cpp b/C++/SortArrayExample2/SortArrayTemplate2.cpp
new file mode 100644
index 0000000..38ce9f9
--- /dev/null
+++ b/C++/SortArrayExample2/SortArrayTemplate2.cpp
@@ -0,0 +1,76 @@
+// Sort Array Example
+// Ch 8
+/*
+ The selection sort algorithm rearranges a list by selecting an element in the list and moving it
+ to its proper position. This algorithm finds the location of the smallest element in the unsorted
+ portion of the list and moves it to the top of the unsorted portion of the list. The first time,
+ we locate the smallest item in the entire list. The second time, we locate the smallest item in
+ the list starting from the second element in the list, and so on.
+ */
+
+#include <iostream>
+
+using namespace std;
+
+// Constant declarations
+const int ARRAY_SIZE = 8;
+
+void sortArray(int list[]) {
+ // Variable declarations
+ int smallestIndex;
+ int temp;
+ // Outer FOR loop controls current location of the smallest index
+ // notice that you iterate to one LESS than the array size
+
+ for ( int i = 0; i < ARRAY_SIZE - 1; i++ ) {
+
+
+
+
+ smallestIndex = i; // Find the location of the smallest element
+ // sets smallest value to first item in array
+ // Inner FOR loop iterates through the array to compare two values
+
+ for (int currentLocation = i+1; currentLocation < ARRAY_SIZE; currentLocation++) {
+ // ...if the current value is less than the current smallest value...
+ if (list[currentLocation] < list[smallestIndex]) {
+ // ...then set the smallest value to the current value
+ smallestIndex = currentLocation;
+ }
+ }
+
+ // Move the smallest element to the beginning of the unsorted list - note 3 variables needed
+
+ temp = list[smallestIndex];
+ list[smallestIndex] = list[i];
+ list[i] = temp;
+ }
+
+ // Output sorted array
+
+ cout << "Sorted Array: " << endl;
+ for ( int i = 0; i < ARRAY_SIZE; i++) {
+ cout << list[i] << endl;
+ }
+ cout << endl;
+
+}
+
+int main()
+{
+ //var dec
+ int list[ARRAY_SIZE] = {16, 30, 24, 7, 62, 45, 5, 55};
+ // Program title and description
+ cout << "Selection Sort Example" << endl << endl;
+
+ // Output original unsorted array
+ for ( int i = 0; i < ARRAY_SIZE; i++) {
+ cout << list[i] << endl;
+ }
+ cout << endl;
+
+ sortArray(list);
+
+
+ return 0;
+}
diff --git a/C++/Sorting Data/SortingData.cpp b/C++/Sorting Data/SortingData.cpp
new file mode 100644
index 0000000..252c4f5
--- /dev/null
+++ b/C++/Sorting Data/SortingData.cpp
@@ -0,0 +1,138 @@
+// Name: msglm
+// Date: Sep 8th, 2022
+// Program Name: Sorting Data
+// Description: Given a file of first and last names, sort them.
+
+#include <iostream>
+#include <fstream>
+#include <string>
+using namespace std;
+
+//Constants
+const int ARR_SIZE = 100;
+
+//This function takes reads a file from a
+//location and turns it into a passed array
+//The array and file are both passed by reference.
+//
+//
+//Only if Stroustrup spent less time adding OOP to C
+//and just made arrays and functions play nice
+int read(string location, ifstream & fileVar, string (&array)[ARR_SIZE]) {
+ int epoch = 0;
+ fileVar.open(location);
+
+ if (!fileVar) {
+ cout << "ERROR! " << location << " failed to open!";
+ exit(1); //I am going to take the risky route and not use a return here
+ //Here is to hoping that Microsoft's MSVC is compliant with
+ //the standard C++ definition of 'exit'
+ //
+ //I have had troubles before since I use GCC
+ //MSVC is almost never in sync with other compilers
+ }
+
+ while (getline(fileVar, array[epoch]) && fileVar.peek() != EOF) {
+ epoch++;
+ }
+ //Since this function has the true size of the array already,
+ //we can just return it for other functions use
+ return epoch;
+}
+
+//Very bog standard bubble sort implementation
+//
+//This sorts an array that's passed by reference
+//
+//On another note, someone needs to make a better
+//language for teaching algorithms
+//they're ugly in code and horrendus in math notation
+void sort(string (&array)[ARR_SIZE], int size) {
+
+ string temp;
+ string * sortedArray = new string[ARR_SIZE];
+
+ //For every single position in an array
+ //
+ //This is what dictates how many "passes" on the array is done
+ for (int pos = 0; pos < size; pos++) {
+ //note a counter called compare position
+ //this counter, if it less than the size minus the current position in the array, then the counter will be added to
+ //
+ //This is where the actual comparision is done
+ for (int comparePos = 0; comparePos < size - pos; comparePos++) {
+ //so long as the compared position is less than the size of the array subtracted by the position
+ //check if the current position being compared is greater than the next position
+ //assign the currently compared position to temp,
+ //turn the current position into the next position
+ //then turn the next position in to the temp position
+ //this swaps array[comparePos] and array[comparePos + 1]
+ //
+ //This is where the actual swapping is done
+ if(array[comparePos] > array[comparePos + 1]) {
+ temp = array[comparePos];
+ array[comparePos] = array[comparePos + 1];
+ array[comparePos + 1] = temp;
+ }
+ }
+ }
+}
+
+
+int main() {
+ //Variable declaration
+ int choice;
+ string fname[ARR_SIZE];
+ string lname[ARR_SIZE];
+ string cname[ARR_SIZE];
+ ifstream fnameFile;
+ ifstream lnameFile;
+ int fsize;
+ int lsize;
+
+ //No input validation here since the rubric doesn't call for it.
+ cout << "1. Sort by First Name\n";
+ cout << "2. Sort by Last Name\n";
+ cout << "Enter Selection: ";
+ cin >> choice;
+
+ //Read the files into an array and output the size of said array to a variable
+ fsize = read("fname.txt", fnameFile, fname);
+ lsize = read("lname.txt", lnameFile, lname);
+
+ //Some cheap error checking since we have fsize and lsize
+ if (!fsize==lsize) {
+ cout << "ERROR: your first name and last name files do now have parity!";
+ exit(1);
+ }
+
+ //menu choices now matter
+ //
+ //I opt to go ahead and combine the names whe comparing since it's just easier to deal with
+ //Perhaps it would have been more efficent to do this in the "read" function, but it's a little late now
+ if (choice == 1) {
+ for(int epoch = 0; epoch < fsize+1; epoch++) {
+ cname[epoch] = fname[epoch] + " " + lname[epoch];
+ }
+ sort(cname, fsize);
+ for(int epoch = 0; epoch < fsize+1; epoch++) {
+ cout << cname[epoch] << endl;
+ }
+ } else {
+ for(int epoch = 0; epoch < fsize+1; epoch++) {
+ cname[epoch] = lname[epoch] + " " + fname[epoch];
+ }
+ sort(cname, fsize);
+ for(int epoch = 0; epoch < fsize+1; epoch++) {
+ cout << cname[epoch] << endl;
+ }
+ }
+}
+
+/*
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License Version 3 ONLY as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
diff --git a/C++/Sorting Data/fname.txt b/C++/Sorting Data/fname.txt
new file mode 100644
index 0000000..a72e2e2
--- /dev/null
+++ b/C++/Sorting Data/fname.txt
@@ -0,0 +1,100 @@
+James
+Robert
+John
+Michae
+David
+Willia59
+Richar
+Joseph
+Thomas
+Charle
+Christ
+Daniel
+Matthe
+Anthon
+Mark
+Donald
+Steven
+Paul
+Andrew
+Joshua
+Kennet
+Kevin
+Brian
+George
+Timoth
+Ronald
+Edward
+Jason
+Jeffre
+Ryan
+Jacob
+Gary
+Nichol
+Eric
+Jonath
+Stephe
+Larry
+Justin
+Scott
+Brando
+Benjam
+Samuel
+Gregor
+Alexan
+Frank
+Patric
+Raymon
+Jack
+Dennis
+Jerry
+Tyler
+Aaron
+Jose
+Adam
+Nathan
+Henry
+Dougla
+Zachar
+Peter
+Kyle
+Ethan
+Walter
+Noah
+Jeremy
+Christ
+Keith
+Roger
+Terry
+Gerald
+Harold
+Sean
+Austin
+Carl
+Arthur
+Lawren
+Dylan
+Jesse
+Jordan
+Bryan
+Billy
+Joe
+Bruce
+Gabrie
+Logan
+Albert
+Willie
+Alan
+Juan
+Wayne
+Elijah
+Randy
+Roy
+Vincen
+Ralph
+Eugene
+Russel
+Bobby
+Mason
+Philip
+Louis
diff --git a/C++/Sorting Data/lname.txt b/C++/Sorting Data/lname.txt
new file mode 100644
index 0000000..0767c24
--- /dev/null
+++ b/C++/Sorting Data/lname.txt
@@ -0,0 +1,100 @@
+Mary
+Patricia
+Jennifer
+1 Linda
+Elizabeth
+0 Barbar
+5 Susan
+Jessica
+Sarah 98
+5 Karen
+4,437 Li
+Nancy 96
+9 Betty
+3 Margar334
+Sandra
+Ashley
+Kimberly
+Emily 83
+Donna 82
+Michelle
+6 Carol
+Amanda
+Dorothy
+Melissa
+0 Debora223
+Stephanie
+Rebecca
+Sharon
+ Laura
+Cynthia
+Kathleen
+Amy 68
+ Angela
+Shirley
+ Anna
+ Brenda
+Pamela
+Emma 59
+Nicole
+ Helen
+ Samant626
+Katherine
+ Christ861
+ Debra
+Rachel
+ Caroly223
+ Janet
+Catherine
+Maria 52
+Heather
+Diane 51
+Ruth 51
+Julie 50
+Olivia
+Joyce 49
+Virginia
+ Victor302
+ Kelly
+Lauren
+Christina
+Joan 46
+Evelyn
+Judith
+Megan 43
+ Andrea
+Cheryl
+Hannah
+Jacquelin410
+Martha
+Gloria
+Teresa
+Ann 40
+Sara 40
+Madison
+ France109
+Kathryn
+Janice
+Jean 39
+Abigail
+Alice 38
+Julia 37
+Judy 37
+ Sophia
+Grace 37
+Denise
+Amber 37
+Doris 37
+Marilyn
+Danielle
+Beverly
+Isabella
+Theresa
+ Diana
+Natalie
+Brittany
+ Charlo576
+Marie 34
+Kayla 34
+Alexis
+ Lori
diff --git a/C++/String Processing/String Processing.cpp b/C++/String Processing/String Processing.cpp
new file mode 100644
index 0000000..4e35a80
--- /dev/null
+++ b/C++/String Processing/String Processing.cpp
@@ -0,0 +1,88 @@
+// Name: msglm
+// Date: September 2nd, 2022
+// Program Name: HTML Parser
+// Description: removes HTML from inputted string.
+
+//any code with /// is merely commented out debug code.
+
+#include <iostream>
+#include <string>
+using namespace std;
+
+//Takes input from user
+string in() {
+ //I personally dislike C++'s streaming capabilities
+ //They aren't like Bash pipes and that's a blunder
+ //I wish I could do getline(cin, '\n') >> return; or getline(cin, '\n') | return;
+ string userInput;
+ getline(cin, userInput, '\n');
+ return userInput;
+}
+
+//processes the input data
+//this is the only process in the entire program thus the
+//term "proc" is accurate. We don't process data in in() or out().
+//
+//How this works is it takes a string, and goes through it char-by-char,
+//once it hits a < it notes its position and marks a flag
+//then it does the same for the next >, marking its pos and marking a flag.
+//once the < and > flags have been raised, the total
+//length of the tag that was detected is calculated, and then the string itself is sliced
+//
+//from there a small bit of clean up is necessary, restarting
+//the position counter to count from the start
+//and resetting the flags.
+
+string proc(string userInput) {
+ bool insideATag = false;
+ bool metTheTagTerminator = false;
+ int beginBracketPos;
+ int endBracketPos;
+ int tagLength;
+
+ for (int charPos=0; charPos<=userInput.length();charPos++) {
+ if (insideATag && metTheTagTerminator) {
+ ///cout << "tag found at " << beginBracketPos << " and " << endBracketPos << endl;
+ ///cout << "Full String:" << userInput << endl;
+
+ //Tag length only exists because std::String.erase() doesn't accept
+ //a range, but rather a start and the chars to go. it's accursed.
+ tagLength = (endBracketPos-beginBracketPos)+1;
+ userInput.erase(beginBracketPos, tagLength);
+ charPos = 0;
+ insideATag = false;
+ metTheTagTerminator = false;
+ }
+ if (userInput[charPos] == '<') {
+ insideATag = true;
+ beginBracketPos = charPos;
+ }
+
+ if (userInput[charPos] == '>' && insideATag) {
+ metTheTagTerminator = true;
+ endBracketPos = charPos;
+ }
+
+ ///cout << "char pos: " << charPos << ";" << "char: " << userInput[charPos] << endl;
+
+ }
+ return userInput;
+}
+
+//Outs to screen
+void out(string processedString) {
+ cout << "sanitized: " << processedString << endl;
+}
+
+int main() {
+ //LISP called, they want their () back.
+ out(proc(in()));
+}
+
+/*
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License Version 3 ONLY as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
diff --git a/C++/StringExample/StringExample.cpp b/C++/StringExample/StringExample.cpp
new file mode 100644
index 0000000..685bea1
--- /dev/null
+++ b/C++/StringExample/StringExample.cpp
@@ -0,0 +1,57 @@
+// Name: msglm
+// Date:
+// Program Name:
+// Description:
+
+
+#include <iostream>
+#include <string>
+#include <iomanip>
+using namespace std;
+
+// Named constants
+
+int main() {
+
+ //Variable declaration
+ string fname;
+ string lname;
+ string wholename;
+
+ //Program title and description for the user
+ // User input
+ cout << "enter first name: ";
+ cin >> fname;
+ cout << "enter last name: ";
+ cin >> lname;
+ wholename = fname + " " + lname;
+ cout << wholename;
+
+ cout << "Length of fname: " << fname.length() << endl;
+ cout << "Length of lname: " << lname.length() << endl;
+ cout << "Length of wholename: " << wholename.length() << endl;
+
+ cout << "Index/position of position 'u': " << wholename.find('e') << endl;
+
+ cout << "Index/position of every character in the string: " << endl;
+ for( int i = 0; i < wholename.length(); i++ ) {
+ cout << i << " " << wholename[i] << endl;
+ }
+
+ cout << "wholename from position 4 to 8 = " << wholename.substr(4,5) << endl;
+
+ fname.clear();
+ cout << "fname: " << fname << endl;
+
+ cout << "Is first name empty?: " << fname.empty() << endl;
+ cout << "Is last name empty?: " << lname.empty() << endl;
+
+ return 0;
+}
+
+ /*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/Structs/INSTRUCTIONS b/C++/Structs/INSTRUCTIONS
new file mode 100644
index 0000000..29cba01
--- /dev/null
+++ b/C++/Structs/INSTRUCTIONS
@@ -0,0 +1,44 @@
+
+Project 5: Structs
+Due Friday, September 30th before midnight
+100 Points
+Create a program that uses a struct with array or vector variables that do the following:
+
+ Get the below information:
+ First Name
+ Last Name
+ Job Title
+ Employee Number
+ Hours Worked
+ Hourly Wage
+ Number of Deductions Claimed
+ Determine if the employee is entitled to overtime (see videos for explanation of overtime)
+ Determine tax rate based on deductions claimed (see videos for explanation of deductions)
+ Determine gross pay, taxes withheld, and netpay
+ Output all information to the screen, but only output overtime if the employee has it
+
+Assignment Notes:
+
+ You may get the data from the user via the keyboard or use an input file to read in an unknown number of records into your program. Your choice.
+ Also, you may also use vectors instead of arrays in your struct. Again, your choice
+ You should not ask the user for their tax rate, gross pay, net pay, or taxes withheld. Your program should do this for the user.
+ I expect to see functions for steps 1 - 5 above, however, you may combine functions if you wish to save space in your program
+
+General Notes:
+Be sure to use comments in your program: Name, Program Description, Date and anywhere else in the program you deem necessary.
+If you are stuck, I will help you!
+Grading Rubric:
+
+ If you do not include comments at the top of the program (name, program description, date), you will lose 15 points
+ If your program does not use functions, you will lose up to 50 points (depending on the number of functions missing)
+ If your program does not compile (run), then I will give a grade of 0/100. But will give you the change to repair for points back (some points are better than none)
+ If your program is late (within 48 hours of the due date), you will lose 25 points
+ If your program is late beyond the 48 hour due date, I will typically still accept it, but you will lose far more points. Depends on when you turn it in
+ If your program uses global variables, I will deduct 5 points for each used
+ If your program is not formatted nicely (code all over the place, ugly), you will lose up to 25 points depending on the extent
+ If your program stops working when I run it, you will lose points. The exact amount depends on the severity of the error
+ If your program still has your friend's name on it, I will send you a message asking you to try harder while giving you a 0/100
+ If your program looks like a a professional programmer wrote it, I will write to you to ask if you want a job. Well, maybe not. But, I will ask about the code
+ This is just a list of typical issues I run into when grading to give you some idea of where your points go. Points can be taken off for other reasons.
+
+
diff --git a/C++/Structs/Structs.cpp b/C++/Structs/Structs.cpp
new file mode 100644
index 0000000..e556264
--- /dev/null
+++ b/C++/Structs/Structs.cpp
@@ -0,0 +1,112 @@
+// Name: msglm
+// Date: Sep 29th, 2022
+// Program Name: Structs
+// Description: Given an input file, output gross pay, taxes, net pay, and other financial information.
+
+#include <iostream>
+#include <fstream>
+#include <string>
+using namespace std;
+
+
+//Structures
+struct Employee {
+ string fname;
+ string lname;
+ string job;
+ int employeeNum;
+ float hrsWorked;
+ float wage;
+ int deductions;
+};
+
+//Takes in the initalized file and turns it into a vector of arrays of strings
+Employee serializeIntoStruct(ifstream & fileVar) {
+ Employee temp;
+ getline(fileVar, temp.fname);
+ getline(fileVar, temp.lname);
+ getline(fileVar, temp.job);
+ fileVar >> temp.employeeNum;
+ fileVar >> temp.hrsWorked;
+ fileVar >> temp.wage;
+ fileVar >> temp.deductions;
+ return temp;
+}
+
+//given hours work, return the amount of overtime.
+float overtime(Employee employee) {
+ if (employee.hrsWorked > 40) {
+ float oTHours = employee.hrsWorked - 40;
+ if (oTHours > 0) {
+ return oTHours;
+ }
+ }
+ return 0;
+}
+
+//Given the deductions, return the taxrate
+float taxRate(Employee employee) {
+ if (employee.deductions <= 0) {
+ return 0.30;
+ } else if (0.30-(employee.deductions*0.05) <= 0.10) {
+ return 0.10;
+ } else {
+ return 0.30-(employee.deductions*0.05);
+ }
+}
+
+//Intake the employee in question, his overtime, and then the tax rate he's subject to
+//
+void outputGrossTaxPay(Employee employee, float overtime, float taxRate) {
+
+ float overtimePay = overtime*(employee.wage*1.5);
+ float normalPay;
+ if (overtime > 0) {
+ normalPay = employee.wage*40;
+ } else {
+ normalPay = employee.wage*employee.hrsWorked;
+ }
+ float grossPay = overtimePay + normalPay;
+ float withheld = taxRate*grossPay;
+ cout << "Employee Name: " << employee.fname << " " << employee.lname << endl;
+ cout << "Job Title: " << employee.job << endl;
+ cout << "Employee Number: " << employee.employeeNum << endl;
+ cout << "Hours Worked: " << employee.hrsWorked << endl;
+ cout << "Hourly Wage: $" << employee.wage << endl;
+ cout << "Deductions Claimed: " << employee.deductions << endl;
+ if (overtime > 0) {
+ cout << "Overtime Hours: " << overtime << endl;
+ cout << "Overtime Pay: $" << overtimePay << endl;
+ }
+ cout << "Gross Pay: $" << grossPay << endl;
+ cout << "Tax Withheld: $" << withheld << endl;
+ cout << "Net Pay: $" << grossPay-withheld << endl;
+
+
+
+}
+
+int main() {
+ //Variable declaration
+ ifstream fileVar;
+ fileVar.open("input.txt");
+
+ if (!fileVar) {
+ cout << "ERROR! input.txt failed to open!";
+ exit(1);
+ }
+
+ Employee readValues = serializeIntoStruct(fileVar);
+ outputGrossTaxPay(readValues, overtime(readValues), taxRate(readValues));
+
+
+
+}
+
+/*
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License Version 3 ONLY as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
diff --git a/C++/Structs/input.txt b/C++/Structs/input.txt
new file mode 100644
index 0000000..91705a5
--- /dev/null
+++ b/C++/Structs/input.txt
@@ -0,0 +1,7 @@
+Anonymous
+Anonymous
+IT Technician
+2450
+40
+14.50
+2
diff --git a/C++/StudentScoreWithLoop/studentScore.txt b/C++/StudentScoreWithLoop/studentScore.txt
new file mode 100644
index 0000000..647019e
--- /dev/null
+++ b/C++/StudentScoreWithLoop/studentScore.txt
@@ -0,0 +1,6 @@
+Indira Dutta
+67.2 58.54 98.3
+Anonymous Anonymous
+30.4 90.4 75.4
+Jarvis Henderson
+40.3 24.5 90.4
diff --git a/C++/StudentScoreWithLoop/studentScoreWithLoop.cpp b/C++/StudentScoreWithLoop/studentScoreWithLoop.cpp
new file mode 100644
index 0000000..1f59c4e
--- /dev/null
+++ b/C++/StudentScoreWithLoop/studentScoreWithLoop.cpp
@@ -0,0 +1,63 @@
+// Name: msglm
+// Date:
+// Introduction:
+// Description:
+
+
+#include <iostream>
+#include <string>
+#include <fstream>
+#include <iomanip>
+using namespace std;
+
+// Named constants
+
+int main() {
+
+ //Variable declaration
+ ifstream inFile;
+ ofstream outFile;
+ string name;
+ double test1, test2, test3;
+ double average;
+ int iterator = 0;
+
+ //Program title and description for the user
+ //cout << "Title: " << endl << "Description: " << endl;
+
+ // User input
+ // Dealing with input/output files
+ inFile.open("studentScore.txt");
+ outFile.open("testavg.out");
+
+ //Output header information
+ outFile << fixed << showpoint << setprecision(2);
+ outFile << setw(17) << left << "Name: " << setw(8) << "Test 1" << setw(8) << "Test 2" << setw(8) << "Test 3" << setw(8) << "Average" << endl;
+
+ while (iterator < 3){
+ //Reading from the file
+ getline(inFile, name);
+ inFile >> test1 >> test2 >> test3;
+ inFile.ignore();
+
+ // Calculations
+ average = (test1+test2+test3)/3.0;
+
+ // Output to the screen
+ outFile << setw(17) << left << name << setw(8) << test1 << setw(8) << test2 << setw(8) << test3 << setw(8) << average << endl;
+ iterator++;
+ }
+ inFile.close();
+ outFile.close();
+
+ cout << "Please Check testavg.out file" << endl;
+
+ return 0;
+}
+
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/StudentScoreWithLoop/testavg.out b/C++/StudentScoreWithLoop/testavg.out
new file mode 100644
index 0000000..8624224
--- /dev/null
+++ b/C++/StudentScoreWithLoop/testavg.out
@@ -0,0 +1,4 @@
+Name: Test 1 Test 2 Test 3 Average
+Indira Dutta 67.20 58.54 98.30 74.68
+Anonymous Anonymous 30.40 90.40 75.40 65.40
+Jarvis Henderson 40.30 24.50 90.40 51.73
diff --git a/C++/SumOfIntegers/SumOfIntegers.cpp b/C++/SumOfIntegers/SumOfIntegers.cpp
new file mode 100644
index 0000000..b917243
--- /dev/null
+++ b/C++/SumOfIntegers/SumOfIntegers.cpp
@@ -0,0 +1,79 @@
+// Name: msglm
+// Date:
+// Program Name:
+// Description:
+
+
+#include <iostream>
+#include <string>
+#include <iomanip>
+using namespace std;
+
+// Named constants
+
+int main() {
+
+ //Variable declaration
+ int numOfNums;
+ int num;
+ int sum;
+ int iterator;
+ char choice;
+ //Program title and description for the user
+ cout << "Title: Sum of Integers" << endl << "Description: Takes user input and provides of sum of said input. only 2 to 10 numbers and the number must be greater than 0 but less than 1000" << endl;
+
+ do {
+
+ // User input
+ do
+ {
+ cout << "How many integers do you wish to add?: \n";
+ cin >> numOfNums;
+
+ if (!cin) {
+ cout << "That is not an integer. Program will terminate.\n";
+ return 1;
+ }
+
+ if (numOfNums < 2) {
+ cout << "Addition requires at least two values" << endl;
+ }
+
+ if (numOfNums > 10) {
+ cout << "This program can only add up to 10 values" << endl;
+ }
+ } while(numOfNums < 2 || numOfNums > 10 || !cin);
+
+ // Calculations
+ for(iterator=1; iterator <= numOfNums; iterator++) {
+ do {
+ cout << "Enter an integer (in a range from 0 to 1000): \n";
+ cin >> num;
+ if (!cin) {
+ cout << "That is not an integer. Program will terminate.\n";
+ return 1;
+ }
+ if(num<0 || num>1000){
+ cout << "Invalid number. Only numbers in the range of 0 to 1000 are accepted\n\n";
+ }
+
+ }while(num < 0 || num > 1000);
+ sum = sum + num;
+
+
+ // Output to the screen
+ cout << "\nThe sumnation of " << numOfNums << " integer values you inputted is: " << sum << endl;
+
+ cout << "Do you want to run the program again? (Y/N)" << endl;
+ cin >> choice;
+ cout << endl << endl;
+ }
+ } while(choice == 'Y' || choice == 'y');
+ cout << "Terminating";
+}
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/SumOfRange/Sum of Range program instruction.docx b/C++/SumOfRange/Sum of Range program instruction.docx
new file mode 100644
index 0000000..abc6187
--- /dev/null
+++ b/C++/SumOfRange/Sum of Range program instruction.docx
Binary files differ
diff --git a/C++/SumOfRange/SumOfRange.cpp b/C++/SumOfRange/SumOfRange.cpp
new file mode 100644
index 0000000..9203606
--- /dev/null
+++ b/C++/SumOfRange/SumOfRange.cpp
@@ -0,0 +1,87 @@
+// Name: msglm
+// Date:
+// Program Name:
+// Description:
+
+
+#include <iostream>
+#include <string>
+#include <iomanip>
+using namespace std;
+
+// Named constants
+
+int main() {
+
+ //Variable declaration
+ int start;
+ int end;
+ int num;
+ int sum;
+ int iterator;
+ char choice;
+ //Program title and description for the user
+ cout << "Title: Sum of Range" << endl << "Description: Takes two inputs, a start and an end. This program adds all numbers between the start in the end (inclusive) and prints the results." << endl;
+
+ do {
+
+ // User input
+ do
+ {
+ cout << "What is your first integer? \n";
+ cin >> start;
+ cout << "What is your last integer? \n";
+ cin >> end;
+
+ if (!cin) {
+ cout << "That is not an integer. Program will terminate.\n";
+ return 1;
+ }
+
+
+ if (start < 0 || end < 0) {
+ cout << "Values cannot be negative" << endl;
+ cin.clear();
+ cin.ignore(100, '\n');
+ cout << "Please try again\n";
+ }
+
+ if (start > 50 || end > 50) {
+ cout << "You cannot numbers greater than 50" << endl;
+ cin.clear();
+ cin.ignore(100, '\n');
+ cout << "Please try again\n";
+ }
+
+ if (start >= end) {
+ cout << "The starting number must be less than the ending number" << endl;
+ cin.clear();
+ cin.ignore(100, '\n');
+ cout << "Please try again\n";
+ }
+
+ } while(start < 0 || end < 0 || start > 50 || end > 50 || !cin || start >= end);
+
+ // Calculations
+ sum = 0;
+
+ for(start; start <= end; start++) {
+ sum = start + sum;
+ }
+
+
+ // Output to the screen
+ cout << "\nThe sum is: " << sum << endl;
+
+ cout << "Do you want to run the program again? (Y/N)" << endl;
+ cin >> choice;
+ cout << endl << endl;
+ } while(choice == 'Y' || choice == 'y');
+ cout << "Terminating";
+}
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/SummerJob/Summer Job Program - planning sheet.docx b/C++/SummerJob/Summer Job Program - planning sheet.docx
new file mode 100644
index 0000000..06ec803
--- /dev/null
+++ b/C++/SummerJob/Summer Job Program - planning sheet.docx
Binary files differ
diff --git a/C++/SummerJob/Summer Job Program - planning sheet.odt b/C++/SummerJob/Summer Job Program - planning sheet.odt
new file mode 100644
index 0000000..787eb0d
--- /dev/null
+++ b/C++/SummerJob/Summer Job Program - planning sheet.odt
Binary files differ
diff --git a/C++/SummerJob/Summer Job Program - planning sheet.pdf b/C++/SummerJob/Summer Job Program - planning sheet.pdf
new file mode 100644
index 0000000..13ce8b6
--- /dev/null
+++ b/C++/SummerJob/Summer Job Program - planning sheet.pdf
Binary files differ
diff --git a/C++/SummerJob/SummerJob.cpp b/C++/SummerJob/SummerJob.cpp
new file mode 100644
index 0000000..e8459d5
--- /dev/null
+++ b/C++/SummerJob/SummerJob.cpp
@@ -0,0 +1,56 @@
+// Name: msglm
+// Introduction: Summer Job Wage Calculator
+// Description: a program that calculates a weekly wage, based on an hourly payrate and how many hours were worked; then calculates amounts for various categories of spending, along with how much of the weekly pay is leftover.
+
+
+#include <iostream>
+#include <string>
+using namespace std;
+int main() {
+
+ string name;
+ float payRate;
+ float hours;
+ float WeeklyWage;
+
+ //Accept input via cin for hourly wages, pay rate, and name
+
+ cout << "What is your name?: ";
+ getline(cin, name);
+
+ cout << "What is your payrate (per hour)?: ";
+ cin >> payRate;
+
+ cout << "How many hours have you worked?: ";
+ cin >> hours;
+
+ //Multiply the input to create the WeeklyWage variable
+ //Possible memory optimization here by removing the WeeklyWage variable, but at the cost of CPU cycles.
+ WeeklyWage = hours*payRate;
+
+ //Print the User’s name
+ cout << "Name: " << name << endl;
+
+
+ //Print the Wage
+ cout << "Wages: " << WeeklyWage << "$" << endl;
+
+ //have a bunch of cout statements that do all the math
+ // I.e : cout << “Tax: “ << WeeklyWage*0.15
+
+ cout << "Tax: $" << WeeklyWage*0.15 << endl;
+ cout << "Shopping: $" << WeeklyWage*0.20 << endl;
+ cout << "Entertainment: $" << WeeklyWage*0.10 << endl;
+ cout << "Savings: $" << WeeklyWage*0.25 << endl;
+ cout << "Remainder: $" << WeeklyWage*0.30 << endl;
+
+ return 0;
+
+}
+
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/TakeOrderV1/.~lock.Take Order Program Instructions (v1).docx# b/C++/TakeOrderV1/.~lock.Take Order Program Instructions (v1).docx#
new file mode 100644
index 0000000..708010e
--- /dev/null
+++ b/C++/TakeOrderV1/.~lock.Take Order Program Instructions (v1).docx#
@@ -0,0 +1 @@
+,msglm,msglm-laptop,04.04.2022 12:07,file:///home/msglm/.config/libreoffice/4; \ No newline at end of file
diff --git a/C++/TakeOrderV1/Take Order Program Instructions (v1).docx b/C++/TakeOrderV1/Take Order Program Instructions (v1).docx
new file mode 100644
index 0000000..28fa77f
--- /dev/null
+++ b/C++/TakeOrderV1/Take Order Program Instructions (v1).docx
Binary files differ
diff --git a/C++/TakeOrderV1/TakeOrderV1.cpp b/C++/TakeOrderV1/TakeOrderV1.cpp
new file mode 100644
index 0000000..23fb08a
--- /dev/null
+++ b/C++/TakeOrderV1/TakeOrderV1.cpp
@@ -0,0 +1,101 @@
+// Name: msglm
+// Date:
+// Program Name:
+// Description:
+
+
+#include <iostream>
+#include <string>
+#include <iomanip>
+using namespace std;
+
+// Named constants
+
+int main() {
+
+ //Variable declaration
+ int items;
+ int menuNum;
+ char size;
+ string curItem;
+ string curSize;
+ float price;
+ //Program title and description for the user
+ cout << "Welcome to Anonymous's Dine and Shine" << endl << endl;
+
+ //User Information
+ cout << "Menu: \n";
+ cout << "1 - Burger\n";
+ cout << "2 - Fries\n";
+ cout << "3 - Drink\n";
+
+ cout << "Sizes: \n";
+ cout << "S - Small $4.25\n";
+ cout << "M - Medium $5.50\n";
+ cout << "L - Large $7.50\n";
+
+ // User input
+ cout << "How many items would you like to buy?: ";
+ cin >> items;
+
+ for (int itemNum = 1; itemNum <= items; itemNum++) {
+ cout << "Order Number " << itemNum << endl;
+
+ //User input
+ cout << "Enter the menu number for your item: \n";
+ cin >> menuNum;
+ cout << "Enter the size of that item: \n";
+ cin >> size;
+
+ //Price and String Output figuring
+ switch(menuNum) {
+ case 1:
+ curItem = "Burger";
+ break;
+ case 2:
+ curItem = "Fries";
+ break;
+ case 3:
+ curItem = "Drink";
+ break;
+ default:
+ cout << "Invalid Entry. Terminating";
+ return 1;
+ }
+
+ switch(size) {
+ case 's':
+ case 'S':
+ curSize = "Small";
+ price = price + 4.25;
+ break;
+ case 'm':
+ case 'M':
+ curSize = "Medium";
+ price = price + 5.50;
+ break;
+ case 'l':
+ case 'L':
+ curSize = "Large";
+ price = price + 7.50;
+ break;
+ default:
+ cout << "Invalid Entry. Terminating";
+ return 1;
+ }
+
+ cout << "For Order " << itemNum << " you ordered a " << curSize << " " << curItem << endl;
+
+ }
+ //Output Prices
+ cout << "Sub Total: " << setprecision(3) << price << endl;
+ cout << "Tax: " << setprecision(3) << price*0.10 << endl;
+ cout << "Total: " << setprecision(3) << price+(price*0.10) << endl;
+}
+
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/TakeOrderV2/Take Order Program Instructions (v2).docx b/C++/TakeOrderV2/Take Order Program Instructions (v2).docx
new file mode 100644
index 0000000..29e32de
--- /dev/null
+++ b/C++/TakeOrderV2/Take Order Program Instructions (v2).docx
Binary files differ
diff --git a/C++/TakeOrderV2/TakeOrderV2.cpp b/C++/TakeOrderV2/TakeOrderV2.cpp
new file mode 100644
index 0000000..8aafdc2
--- /dev/null
+++ b/C++/TakeOrderV2/TakeOrderV2.cpp
@@ -0,0 +1,203 @@
+// Name: msglm
+// Date:
+// Program Name:
+// Description:
+
+
+#include <iostream>
+#include <string>
+#include <iomanip>
+using namespace std;
+
+// Named constants
+
+
+/*
+ * Not using header files for this project
+ * So there's no reason to define below main
+ */
+
+/* cleans up input problems relating to invalid input
+ *
+ * This is of high utility
+ * I might use this function in other projects
+ *
+ * I swear I will end up writing my own input/output funcs for C++
+ * I cannot stand input validation with cin and cout
+ */
+void fixCin() {
+ cin.clear();
+ cin.ignore(1000, '\n');
+ cout << "===ERROR: Invalid Input!===" << endl;
+}
+
+
+/*
+ * Main has incredibly low amounts of code repitition, thus
+ * splitting it up into functions would be fragmented and unmaintainable code
+ *
+ * technically, if I wished to follow the requirements to the letter, I could write something like:
+ *
+ * void TakeOrder() {
+ * all actual processing of code
+ * ...
+ * }
+ *
+ * int main() {
+ * takeOrder()
+ * }
+ *
+ *
+ * for an incredibly low SLOC count in a function
+ * named main, but that'd serve almost no purpose at all
+ * and would just pollute this codebase with an unneeded function.
+ *
+ * An explanation like this should, in spirit, achieve the purpose of the "low SLOC in main" requirement:
+ * showing understanding of functions and displaying an ability to use them.
+ */
+int main() {
+
+ //Variable declaration
+ bool wrongOrder = false;
+ char satisfied;
+ char size = 's';
+ float price;
+ int items = 0;
+ int menuNum = 1;
+ string curItem;
+ string curSize;
+
+ //Program title and description for the user
+ cout << "Welcome to Anonymous's Dine and Shine" << endl << endl;
+
+ //User Information
+ cout << "Menu: \n";
+ cout << "1 - Burger\n";
+ cout << "2 - Fries\n";
+ cout << "3 - Drink\n";
+
+ cout << "Sizes: \n";
+ cout << "S - Small $4.25\n";
+ cout << "M - Medium $5.50\n";
+ cout << "L - Large $7.50\n";
+
+ // User input
+
+ //Order number handling
+ do {
+ if ( !cin ) {
+ fixCin();
+ }
+
+ cout << "How many items would you like to buy?: ";
+ cin >> items;
+ } while ( !cin );
+
+ //For the amount of items requested, offer the user the shop menu
+ for (int itemNum = 1; itemNum <= items; itemNum++) {
+ do {
+ //Just so the user knows what order the program is writing about
+ cout << "Order Number " << itemNum << endl;
+
+
+ //User input
+ //Menu item handling
+ do {
+
+ if ( !cin || menuNum < 1 || menuNum > 3 ) {
+ fixCin();
+ }
+
+ cout << "Enter the menu number for your item: \n";
+ cin >> menuNum;
+
+ } while ( !cin || menuNum < 1 || menuNum > 3 );
+
+
+ //Size of item handling
+ do {
+
+ if ( !cin || !(size == 's' || size == 'S' || size == 'm' || size == 'M' || size == 'l' || size == 'L') ) { //This line is gross, there's probably a better way to do this
+ fixCin();
+ }
+
+ cout << "Enter the size of that item: \n";
+ cin >> size;
+
+ } while ( !cin || !(size == 's' || size == 'S' || size == 'm' || size == 'M' || size == 'l' || size == 'L') );
+
+ //Price and String Output figuring
+
+ /*
+ * In a big project, string comparision like
+ * shown here would not be done at all
+ * instead, some form of ENUM could be used instead
+ *
+ * The only reason I went with string comparision was for
+ * easy debugging when developing. I would never allow
+ * code like this to ever touch any production branches.
+ */
+
+
+ switch(menuNum) {
+ case 1:
+ curItem = "Burger";
+ break;
+ case 2:
+ curItem = "Fries";
+ break;
+ case 3:
+ curItem = "Drink";
+ break;
+ default:
+ cout << "Invalid Entry. Terminating";
+ return 1;
+ }
+
+ switch(size) {
+ case 's':
+ case 'S':
+ curSize = "Small";
+ price = price + 4.25;
+ break;
+ case 'm':
+ case 'M':
+ curSize = "Medium";
+ price = price + 5.50;
+ break;
+ case 'l':
+ case 'L':
+ curSize = "Large";
+ price = price + 7.50;
+ break;
+ default:
+ cout << "Invalid Entry. Terminating";
+ return 1;
+ }
+ cout << "For Order " << itemNum << " you ordered a " << curSize << " " << curItem << endl;
+ cout << "Are you satisfied with this order? (Y/n): ";
+ cin >> satisfied;
+
+ if (satisfied == 'n' || satisfied == 'N') {
+ wrongOrder = true;
+ } else {
+ wrongOrder = false;
+ }
+
+ } while(wrongOrder);
+
+ wrongOrder = false;
+
+ }
+ //Output Prices
+ cout << "Sub Total: $" << setprecision(3) << price << endl;
+ cout << "Tax: $" << setprecision(3) << price*0.10 << endl;
+ cout << "Total: $" << setprecision(3) << price+(price*0.10) << endl;
+}
+
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/TakeOrderV2/instructions.txt b/C++/TakeOrderV2/instructions.txt
new file mode 100644
index 0000000..6fe1592
--- /dev/null
+++ b/C++/TakeOrderV2/instructions.txt
@@ -0,0 +1,7 @@
+The focus of this version/iteration is error checking. All user input should be checked to ensure it is valid input! If they enter an incorrect order, your program should allow them to redo the order. So, TEST, TEST, TEST!!
+When this iteration is graded, here is what I will be looking for:
+
+ That all invalid input is caught, the user is told, and allowed to redo input
+ You have utilized function when needed (at least once)
+ Subtotal, tax, and total are still calculating correctly
+ Anything that stands out to me as inefficient or incorrect
diff --git a/C++/Test1/BookStoreReceipt.cpp b/C++/Test1/BookStoreReceipt.cpp
new file mode 100644
index 0000000..ef6d903
--- /dev/null
+++ b/C++/Test1/BookStoreReceipt.cpp
@@ -0,0 +1,58 @@
+// Name: msglm
+// Date: Feb-14-2022
+// Program Name: Bookstore Receipt Program
+// Description: a program that will calculate the price (plus tax) of a book store recieipt
+
+
+#include <iostream>
+#include <string>
+#include <iomanip>
+using namespace std;
+
+// Named constants
+double const TAX = 0.0964;
+double const BOOKPRICE = 5.00;
+double const COPYPRICE = 1.10;
+double const PENPRICE = 1.15;
+double const FOLDERPRICE = 1.00;
+
+int main() {
+
+ //Variable declaration
+ int book, copy, pen, folder;
+ double total;
+
+ //Program title and description for the user
+ cout << "Title: Bookstore Receipt Program" << endl << "Description: a program that will calculate the price (plus tax) of a book store recieipt" << endl;
+
+ // User input
+ cout << "How many books would you like?\n";
+ cin >> book;
+ cout << "How many packs of copy paper would you like?\n";
+ cin >> copy;
+ cout << "How many packs of pens would you like?\n";
+ cin >> pen;
+ cout << "How many folder packs would you like?\n";
+ cin >> folder;
+ // Calculations for the total price (Without Tax)
+ total = (book*BOOKPRICE + copy*COPYPRICE + pen*PENPRICE + folder*FOLDERPRICE);
+ // Output to the screen
+ cout << "Receipt: \n";
+ cout << "Books: $" << book*BOOKPRICE << endl;
+ cout << "Packs of Copy Paper: $" << copy*COPYPRICE << endl;
+ cout << "Packs of Pens: $" << pen*PENPRICE << endl;
+ cout << "Packs of Folders: $" << folder*FOLDERPRICE << endl;
+ cout << "Total (Without Tax): $" << total << endl;
+ cout << "Total Tax: $" << total*TAX << endl;
+ cout << "Total (With Tax): $" << total+(total*TAX) << endl;
+
+
+ return 0;
+}
+
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/Test1/ErrorCorrection.cpp b/C++/Test1/ErrorCorrection.cpp
new file mode 100644
index 0000000..2a84c23
--- /dev/null
+++ b/C++/Test1/ErrorCorrection.cpp
@@ -0,0 +1,66 @@
+// Your Name: msglm
+// Date: Feb-14-2022
+// Program Title: Make Change
+// Program Description: Given any amount of change expressed in cents, this program
+// computes the number of halh-dollars, quarters, dimes, nickels, and pennies to be
+// returned, returning as many half-dollars as possible, then quarters, dimes, nickels,
+// and pennies in that order.
+
+#include <iostream>
+#include <string>
+
+//Didn't declare namespace as used
+using namespace std;
+
+// Named constants
+
+const int HALF_DOLLAR = 50;
+const int QUARTER = 25;
+const int DIME = 10;
+//Nickel missing int
+const int NICKEL = 5;
+
+int main()
+{
+
+ // Variable declaration
+ int change;
+
+ //Program title and description for the user
+ cout << "Program Title: Make Change" << endl;
+ cout << "Program Description: Given any amount of change expressed in cents, this program "
+ << "computes the number of half-dollars, quarters, dimes, nickels, and pennies to be "
+ //Missing terminating quote
+ << "returned, returning as many half-dollars as possible, then quarters, dimes, nickels,"
+ << "and pennies in that order." << endl << endl;
+
+ // User input
+ cout << "Enter change in cents: ";
+ //Variable capitalized; variables are case sensitive
+ cin >> change;
+ cout << endl;
+
+ cout << "The change you entered is: " << change << endl;
+
+ // Calculations and Output to the screen
+
+ cout << "The number of half-dollars to be returned is: " << change / HALF_DOLLAR << endl;
+ change = change % HALF_DOLLAR;
+
+ //forgot semicolon
+ cout << "The number of quarters to be returned is: " << change / QUARTER << endl;
+ change = change % QUARTER;
+ //Forgot extra <
+ cout << "The number of dimes to be returned is: " << change / DIME << endl;
+ //Variable/Constant names are case sensitive
+ change = change % DIME;
+
+ cout << "The number of nickels to be returned is: " << change / NICKEL << endl;
+ change = change % NICKEL;
+
+ //Forgot to place terminating end-quote
+ cout << "The number of pennies to be returned is: "<< change << endl;
+
+ //Never gave a return code or similar value
+ return 0;
+}
diff --git a/C++/Test2/Exam 2 Program Instruction.docx b/C++/Test2/Exam 2 Program Instruction.docx
new file mode 100644
index 0000000..b70e121
--- /dev/null
+++ b/C++/Test2/Exam 2 Program Instruction.docx
Binary files differ
diff --git a/C++/Test2/RPS.cpp b/C++/Test2/RPS.cpp
new file mode 100644
index 0000000..7ca2f4b
--- /dev/null
+++ b/C++/Test2/RPS.cpp
@@ -0,0 +1,101 @@
+// Name: msglm
+// Date:
+// Program Name: Rock Paper Scissors
+// Description: Rock Paper Scissors
+
+
+#include <iostream>
+#include <string>
+#include <iomanip>
+using namespace std;
+
+// Named constants
+
+int main() {
+
+ //Variable declaration
+ int playerOneChoice;
+ int playerTwoChoice;
+ string result;
+ string playerOneString;
+ string playerTwoString;
+ //Program title and description for the user
+ cout << "Title: Rock Paper Scissors" << endl << "Description: Plays a game of Rock Paper Scissors. Input must be an integer." << endl << endl;
+
+ // User input
+
+ cout << "Player One, Make your choice:\n";
+ cout << "1. Rock \n";
+ cout << "2. Paper \n";
+ cout << "3. Scissors \n";
+ cout << "Player One Input: ";
+ cin >> playerOneChoice;
+
+ cout << "\nPlayer Two, Make your choice: \n";
+ cout << "1. Rock \n";
+ cout << "2. Paper \n";
+ cout << "3. Scissors \n";
+ cout << "Player Two Input: ";
+ cin >> playerTwoChoice;
+
+
+ if (playerOneChoice == playerTwoChoice){ //Draw
+ result = "This match is a Draw";
+ } else if (playerOneChoice == 1 && playerTwoChoice == 3){ //Rock Beats Scissors
+ result = "Player One Victory";
+
+ } else if (playerOneChoice == 2 && playerTwoChoice == 1){ //Paper Beats Rock
+ result = "Player One Victory";
+
+ } else if (playerOneChoice == 3 && playerTwoChoice == 2){ //Scissors Beats Paper
+ result = "Player One Victory";
+ } else {
+ //As the only winning moves and draw incurring moves have already
+ //be checked for player 1, we can assume a victory for two if this position is reached
+ result = "Player Two Victory.";
+ }
+
+ //Convert the inputted number to a string for displaying back to the user
+ switch(playerOneChoice) {
+ case 1:
+ playerOneString = "Rock";
+ break;
+ case 2:
+ playerOneString = "Paper";
+ break;
+ case 3:
+ playerOneString = "Scissors";
+ break;
+ default:
+ cout << "Something went terribly wrong. Your input may have problems";
+ return 1;
+ }
+ switch(playerTwoChoice) {
+ case 1:
+ playerTwoString = "Rock";
+ break;
+ case 2:
+ playerTwoString = "Paper";
+ break;
+ case 3:
+ playerTwoString = "Scissors";
+ break;
+ default:
+ cout << "Something went terribly wrong. Your input may have problems";
+ return 1;
+ }
+
+ //Output
+ cout << "\n\n\nRESULTS:\n";
+ cout << "Player" << setw(15) << "Choice \n";
+ cout << "Player #1:" << setw(12) << playerOneString << endl;
+ cout << "Player #2:" << setw(12) << playerTwoString << endl;
+ cout << result << endl;
+}
+
+ /*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/Test3/Program1.cpp b/C++/Test3/Program1.cpp
new file mode 100644
index 0000000..80cde0e
--- /dev/null
+++ b/C++/Test3/Program1.cpp
@@ -0,0 +1,65 @@
+// Name: msglm
+// Date:
+// Program Name:
+// Description:
+
+
+#include <iostream>
+#include <string>
+#include <iomanip>
+using namespace std;
+
+int main() {
+
+ //Variable declaration
+ int num;
+
+ //Almost opted for a unsigned long long, but the imprecision with using values too high was too great. Floating point precision is king in this regard.
+ double output;
+ char again;
+ bool repeat = true;
+
+ //Program title and description for the user
+ cout << "Title: Find Factorial" << endl << "Description: Given a non-zero number, print its factorial" << endl;
+
+ while(repeat) {
+ // User input
+ cout << "Input the non-negative integar you'd like to find the factorial of: ";
+ cin >> num;
+
+ // Calculations
+ if (num < 0) {
+ cout << "Error! The number you inputted was negative!";
+ } else if (num == 0) {
+ output = 0;
+ } else {
+ output = 1;
+ for(int i = 1; i <= num; i++) {
+ output = i * output;
+ }
+ }
+
+ // Output to the screen
+ cout << "The Factorial of " << num << " is " << fixed << setprecision(0) << output << endl;
+
+ //Go Again
+ cout << "This program supports running again, would you like to run again? (y/n): ";
+ cin >> again;
+ if (again == 'y' || again == 'Y') {
+ repeat = true;
+ cout << "\033[2J\033[1;1H";
+
+ } else {
+ repeat = false;
+ }
+
+ }
+ return 0;
+}
+
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/Test3/Program2.cpp b/C++/Test3/Program2.cpp
new file mode 100644
index 0000000..08976b0
--- /dev/null
+++ b/C++/Test3/Program2.cpp
@@ -0,0 +1,108 @@
+// Name: msglm
+// Date:
+// Program Name:
+// Description:
+
+
+#include <iostream>
+#include <string>
+#include <iomanip>
+using namespace std;
+
+//Function header (probably should be in a header file)
+double celsius_to_fahrenheit(double temp);
+double fahrenheit_to_celsius(double temp);
+
+// Named constants
+
+int main() {
+
+ //Variable declaration
+ double temp;
+ char format;
+ int choice;
+ //Program title and description for the user
+ cout << "Title: Fahrenheit-to-Celsius Converter" << endl << "Description: converts Fahrenheit to Celsius temperature and vice-versa" << endl;
+ do {
+ //If your tempurature is improper, allow fixing
+ if (!cin) {
+ cin.clear();
+ cin.ignore(100, '\n');
+ cout << "\033[2J\033[1;1H";
+ cout << "Your temp was improper, please retry\n";
+ }
+
+ // User input
+ cout << "Enter the Temperature" << endl;
+ cin >> temp;
+
+ cout << "Enter the format (C or F)" << endl;
+ cin >> format;
+
+ //Presumptious error handling since numbers are valid characters
+ if (format != 'c' || format != 'C' || format != 'f' || format != 'F') {
+ cout << "Format is improper. Assuming Celcius.\n";
+ format = 'C';
+ }
+
+ } while (!cin);
+
+ //Display input methods for first time
+ cout << "1. Convert Celsius to Fahrenheit\n";
+ cout << "2. Convert Fahrenheit to Celsius\n";
+ cout << "3. Display Choices\n";
+
+ do {
+ //Get user choice
+ cout << "Choice: ";
+ cin >> choice;
+
+
+ if (choice == 1) {
+ //Ensure this is actually C, if not, do nothing
+ if (format == 'C' || format == 'c') {
+ temp = celsius_to_fahrenheit(temp);
+ format = 'F';
+ }
+
+ } else if (choice == 2) {
+ //Ensure this is actually F, if not, do nothing
+ if (format == 'F' || format == 'f') {
+ temp = fahrenheit_to_celsius(temp);
+ format = 'C';
+ }
+
+ } else {
+ //Choices in case the user forgets
+ cout << "1. Convert Celsius to Fahrenheit\n";
+ cout << "2. Convert Fahrenheit to Celsius\n";
+ cout << "3. Display Choices\n";
+ }
+
+ //Output to screen
+ cout << "\nIt is currently " << temp << " degrees " << format << endl;
+
+ //Cold or Hot detection
+ if (( (format == 'F' || format == 'f') && temp <=32) || ( (format == 'C' || format == 'c') && temp <=0) ) {
+ cout << "Temperature is below freezing.\n";
+ } else if (( (format == 'F' || format == 'f') && temp >= 104) || ( (format == 'C' || format == 'c') && temp >=40) ) {
+ cout << "Temperature is incredibly hot.\n";
+ }
+ } while (cin);
+}
+
+//Functions
+double celsius_to_fahrenheit(double temp) {
+ return temp*(1.8)+32;
+}
+
+double fahrenheit_to_celsius(double temp) {
+ return (temp-32)/(1.8);
+}
+
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/TwoDimensionalArray/TwoDimensionalArray.cpp b/C++/TwoDimensionalArray/TwoDimensionalArray.cpp
new file mode 100644
index 0000000..a96c64b
--- /dev/null
+++ b/C++/TwoDimensionalArray/TwoDimensionalArray.cpp
@@ -0,0 +1,55 @@
+// Name: msglm
+// Date:
+// Program Name:
+// Description:
+
+
+#include <iostream>
+#include <string>
+#include <iomanip>
+#include <fstream>
+using namespace std;
+
+// Named constants
+
+int main() {
+
+ //Variable declaration
+ double test[5][3];
+ string name[5];
+ int row;
+ int col;
+ ifstream inFile;
+ // open file
+ inFile.open("student_data.txt");
+
+ //Title and desc.
+ cout << "Two dimentional array example \n\n this program utilizes parallel arrays: one being an one-dimentional \n array to store student names and the other being a two-dimentional \n array to store 3 exam scores per student. the input will be read fron an external file and then be printed on the screen\n\n";
+
+ //Read arrays data from the file and store in both arrays
+ for (row=0; row < 5; row++) {
+ inFile >> name[row];
+ for (col = 0; col < 3; col++) {
+ inFile >> test[row][col];
+ }
+ }
+ cout << setw(10) << left << "Name" << setw(7) << right << "Test 1" << setw(7) << "Test 2" << setw(7) << "Test 3" << endl;
+
+ for (row = 0; row < 5; row++) {
+ cout << setw(10) << left << name[row];
+ for (col = 0; col < 3; col++) {
+
+ cout << setw(7) << right << test[row][col];
+
+ }
+ cout << endl;
+ }
+}
+
+
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/TwoDimensionalArray/student_data.txt b/C++/TwoDimensionalArray/student_data.txt
new file mode 100644
index 0000000..82312f9
--- /dev/null
+++ b/C++/TwoDimensionalArray/student_data.txt
@@ -0,0 +1,5 @@
+Amy 89 54 92
+Bob 92 88 65
+Carl 75 87 91
+Darla 98 94 90
+Eve 65 75 85 \ No newline at end of file
diff --git a/C++/ValueVsReference/ValueVsReference.cpp b/C++/ValueVsReference/ValueVsReference.cpp
new file mode 100644
index 0000000..cbd0aa5
--- /dev/null
+++ b/C++/ValueVsReference/ValueVsReference.cpp
@@ -0,0 +1,56 @@
+// Name: msglm
+// Date:
+// Program Name:
+// Description:
+
+
+#include <iostream>
+#include <string>
+#include <iomanip>
+using namespace std;
+
+//func decl
+void ValueFunctionEx(int x);
+void ReferenceFunctionEx(int& x);
+
+// Named constants
+
+int main() {
+
+ //Variable declaration
+ int num1;
+ int num2;
+
+ //Program title and description for the user
+ cout << "Title: Value vs Reference Parameter" << endl << "Description: Value parameter Example" << endl;
+
+ cout << "Enter an integer" << endl;
+ cin >> num1;
+ ValueFunctionEx(num1);
+ cout << "Main num1: " << num1 << endl;
+
+ cout << "Enter an integer" << endl;
+ cin >> num2;
+ ReferenceFunctionEx(num2);
+ cout << "Main num1: " << num2 << endl;
+
+ return 0;
+}
+
+void ValueFunctionEx(int x) {
+ x = x * 2;
+ cout << "Value Parameter x: " << x << endl;
+}
+
+void ReferenceFunctionEx(int& x) {
+ x = x * 2;
+ cout << "Value Parameter x: " << x << endl;
+}
+
+
+ /*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/Vectors/Vectors.cpp b/C++/Vectors/Vectors.cpp
new file mode 100644
index 0000000..67adaae
--- /dev/null
+++ b/C++/Vectors/Vectors.cpp
@@ -0,0 +1,139 @@
+// Name: msglm
+// Date: Sep 8th, 2022
+// Program Name: Vectirs
+// Description: Read in a file, output the data to the screen and the student who has the highest credit hours and highest GPA.
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <vector>
+#include <array>
+#include <iomanip>
+using namespace std;
+
+//initalizes the file
+void initalize(string location, ifstream & fileVar) {
+ fileVar.open(location);
+
+ if (!fileVar) {
+ cout << "ERROR! " << location << " failed to open!";
+ exit(1);
+ }
+}
+
+//Takes in the initalized file and turns it into a vector of arrays of strings
+vector<array<string, 10>> serializeIntoVecArr(ifstream & fileVar) {
+ vector<array<string, 10>> studentDataContainer;
+ studentDataContainer.push_back(array<string, 10>());
+ int student = 0;
+ int data = 0;
+
+ while(getline(fileVar, studentDataContainer[student][data]) && fileVar.peek() != EOF) {
+ data = data + 1;
+ if (data == 10) {
+ data = 0;
+ student = student + 1;
+ //This initializes the next set of arrays
+ studentDataContainer.push_back(array<string, 10>());
+ }
+ }
+ return studentDataContainer;
+}
+
+
+//Prints out all the data in a tabular format
+void allData(vector<array<string, 10>> studentDataContainer) {
+
+ //this code repetition is gross
+ //Perhaps I could have made this cleaner
+ cout << left << setw(25) << "First Name" << " ";
+ cout << left << setw(25) << "Last Name" << " ";
+ cout << left << setw(25) << "T-Number" << " ";
+ cout << left << setw(25) << "Major" << " ";
+ cout << left << setw(25) << "Advisor" << " ";
+ cout << left << setw(25) << "GPA" << " ";
+ cout << left << setw(25) << "Credit Hours" << " ";
+ cout << left << setw(25) << "Years until Graduation" << " ";
+ cout << left << setw(25) << "Hardest Class" << " ";
+ cout << left << setw(25) << "Easiest Class" << " ";
+
+ //C++ 11 range based loops
+ //I wish I knew about these earlier
+ for (array<string, 10> student : studentDataContainer) {
+ cout << endl;
+ for (string data : student) {
+ cout << left << setw(25) << data << " ";
+ }
+ }
+
+}
+
+
+
+void highestCreditHours(vector<array<string, 10>> studentDataContainer) {
+ cout << "\n\nStudent with highest credit hours:\n";
+ int highestStudent = 0;
+ int highest = 0;
+
+ //gets the largest using only one pass through
+ for(int studentPos = 0; studentPos < studentDataContainer.size(); studentPos++) {
+ for (string data : studentDataContainer[studentPos]) {
+ if (data[6] > highest) {
+ highest = data[6];
+ highestStudent = studentPos;
+ }
+ }
+ }
+
+ //Outputs all the data of the largest
+ for (int dataPos = 0; dataPos < 10; dataPos++) {
+ cout << left << setw(25) << studentDataContainer[highestStudent][dataPos] << " ";
+ }
+}
+
+//clone of highestCreditHours
+void highestGPA(vector<array<string, 10>> studentDataContainer) {
+ cout << "\n\nStudent with highest GPA \n";
+ int highestStudent = 0;
+ int highest = 0;
+
+ for(int studentPos = 0; studentPos < studentDataContainer.size(); studentPos++) {
+ for (string data : studentDataContainer[studentPos]) {
+ if (data[7] > highest) {
+ highest = data[7];
+ highestStudent = studentPos;
+ }
+ }
+ }
+
+ for (int dataPos = 0; dataPos < 10; dataPos++) {
+ cout << left << setw(25) << studentDataContainer[highestStudent][dataPos] << " ";
+ }
+
+}
+
+int main() {
+ //Variable declaration
+ ifstream data;
+
+
+ //"Read in an unknown number of records from an input file and store that data into vector variables for the below"
+ //
+ //The data will be going into a vector, but that vector will hold arrays at a fixed size since each student's data will be fixed
+ //This makes accessing the data infinitely easier
+ initalize("input.txt", data);
+ vector<array<string, 10>> serializedVectorArray = serializeIntoVecArr(data);
+
+ allData(serializedVectorArray);
+ highestCreditHours(serializedVectorArray);
+ highestGPA(serializedVectorArray);
+
+}
+
+/*
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License Version 3 ONLY as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
diff --git a/C++/Vectors/input.txt b/C++/Vectors/input.txt
new file mode 100644
index 0000000..a7ff2f7
--- /dev/null
+++ b/C++/Vectors/input.txt
@@ -0,0 +1,50 @@
+James
+May
+T-20425
+Information Technology
+Jeff Kenney
+4.0
+36
+2
+Ethics
+Programming
+Jennifer
+May
+T-22343
+Information Technology
+Jeff Kenney
+3.0
+26
+3
+Repiar
+Programming
+Anonymous
+Anonymous
+T-11111
+Information Technology
+Megan Lastname
+3.98
+30
+2
+Critical Thinking
+Orientation
+Epic
+Fail
+T-2042587
+Information Technology
+Jef Kenney
+2.0
+50
+2
+beingalive
+fail
+r
+rMay
+T-22143120425
+Information Technology
+Jeff Kenney
+2.76
+20
+3
+r
+r
diff --git a/C++/Vectors/instructions.txt b/C++/Vectors/instructions.txt
new file mode 100644
index 0000000..a40c663
--- /dev/null
+++ b/C++/Vectors/instructions.txt
@@ -0,0 +1,39 @@
+ Write a program that does the following:
+
+ Read in an unknown number of records from an input file and store that data into vector variables for the below:
+ First Name
+ Last Name
+ T-Number
+ Major
+ Advisor Name
+ GPA
+ Credit Hours
+ Year expected to graduate
+ Hardest class taken so far
+ Easiet class taken so far
+
+ Use functions for each of the below:
+ Function to check to see if input file was found
+ Function to read in data from input file
+ Function to output all data to screen and output file
+ Function to output the student's information that has the highest number of credit hours
+ Function to output the student's information that has the highest GPA
+
+General Notes:
+Be sure to use comments in your program: Name, Program Description, Date and anywhere else in the program you deem necessary. You do not need to sort the data to get the highest credit hours or GPA. There are much easier ways of doing this.
+If you are stuck, I will help you!
+Grading Rubric:
+
+ If you do not include comments at the top of the program (name, program description, date), you will lose 15 points
+ If you do not use functions, you will use 10 points per missing function (50 points)
+ If your program does not compile (run), then I will give a grade of 0/100. But will give you the change to repair for points back (some points are better than none)
+ If your program is late (within 48 hours of the due date), you will lose 25 points
+ If your program uses global variables, you will lose 5 points for each used
+ If your program is late beyond the 48 hour due date, I will typically still accept it, but you will lose far more points. Depends on when you turn it in
+ If you submit your program in a Word document, you will lose 20 points and will need to resubmit your program for grading. Please only submit .cpp files
+ If your program is not formatted nicely (code all over the place, ugly), you will lose up to 25 points depending on the extent
+ If your program stops working when I run it, you will lose points. The exact amount depends on the severity of the error
+ If your program still has your friend's name on it, I will send you a message asking you to try harder while giving you a 0/100
+ If your program looks like a professional programmer wrote it, I will write to you to ask if you want a job. Well, maybe not. But, I will ask about the code
+ This is just a list of typical issues I run into when grading to give you some idea of where your points go. Points can be taken off for other reasons.
+
diff --git a/C++/Videos/Chapter 5 (highlighting Do-While loop and Nested loop) 3-4-22 .mp4 b/C++/Videos/Chapter 5 (highlighting Do-While loop and Nested loop) 3-4-22 .mp4
new file mode 100644
index 0000000..e9b613d
--- /dev/null
+++ b/C++/Videos/Chapter 5 (highlighting Do-While loop and Nested loop) 3-4-22 .mp4
Binary files differ
diff --git a/C++/Virtual Functions/INSTRUCTIONS b/C++/Virtual Functions/INSTRUCTIONS
new file mode 100644
index 0000000..cbd1553
--- /dev/null
+++ b/C++/Virtual Functions/INSTRUCTIONS
@@ -0,0 +1,34 @@
+
+HW3: Virtual Functions
+Due November 29th, 2022 before midnight
+50 Points
+Virtual functions are only introduced in this course. You will use them in data structures instead. Therefore, this assignment is meant to let you become familiar with the concept before you move onto that class.
+In this assignment, you will watch the videos about virtual functions. Then, you will answer the below questions:
+
+ What is a virtual function?
+ What is the purpose of a virtual function?
+ Write about a real world situation where you would need to use a virtual function in a program
+ Write a program of your choice demonstrating how a virtual function works
+
+Assignment Notes:
+
+ Look up information using any resource you wish, but you must write your answers in your own words. Copy/paste = 0/50
+ Since you are writing a short program to demonstrate virtual functions, you may put answers to questions 1 - 3 as comments within your program
+ Short/vague answers will receive few, if any, points
+
+General Notes:
+Be sure to use comments in your program: Name, Program Description, Date and anywhere else in the program you deem necessary.
+Grading Rubric:
+
+ If you do not include comments at the top of the program (name, program description, date), you will lose 15 points
+ If your program is not object-oriented, you will receive a 0/50(OOP is requred for this assignment)
+ If your work is late (within 48 hours of the due date), you will lose 25 points
+ If your program is late beyond the 48 hour due date, I will typically still accept it, but you will lose far more points. Depends on when you turn it in
+ If your program is not formatted nicely (code all over the place, ugly), you will lose up to 25 points depending on the extent
+ If your program stops working when I run it, you will lose points. The exact amount depends on the severity of the error
+ If your program still has your friend's name on it, I will send you a message asking you to try harder while giving you a 0/50
+ If you submit a file type I cannot open, such as .sln, you will receive a 0/50. You will be able to resubmit for credit, but you will lose points (depending on how late it is)
+ If your program looks like a a professional programmer wrote it, I will write to you to ask if you want a job. Well, maybe not. But, I will ask about the code
+ This is just a list of typical issues I run into when grading to give you some idea of where your points go. Points can be taken off for other reasons.
+
+
diff --git a/C++/Virtual Functions/VirtualFunctions.cpp b/C++/Virtual Functions/VirtualFunctions.cpp
new file mode 100644
index 0000000..57fafca
--- /dev/null
+++ b/C++/Virtual Functions/VirtualFunctions.cpp
@@ -0,0 +1,56 @@
+// Name: msglm
+// Date: Nov 25th 2022
+// Program Name: Virtual Functions
+// Description: a look into virtual functions
+
+
+// What is a virtual function?
+//Virtual fucntions are functions that can be redefined and are primarily used for runtime polymorphism. Typically, these functions are accessed via pointers.
+
+// What is the purpose of a virtual function?
+//From what I have seen, the only utility this can serve is for situations when you making an instance of a parent class point to the child class and you need that pointer to call a standardized function within the class' children. I hope that makes sense.
+
+// Write about a real world situation where you would need to use a virtual function in a program
+//The only time I could forsee teaching this is if it's necessary for cirriculum because, as it stands, this is a disgusting enigma of C++ that should not exist. However, to come up with a scenario, let's say this happens:
+//For some reason, we are creating objects in memory in a program and later allocating them. In such as situation, we are dealing with multiple classes of somewhat related concepts, such as animals. All animals have the class "consume", which is unique per animals since animals are of different sizes and can consume different things. The pointer that we created before can then be assigned to an animal and then be used to call the specific consume function of an animal.
+//However, if this is our implementation, then something has gone terribly wrong. Anything universal should be outside of an object and, any objects should be represented by data that is managed by the rest of the program. I.e, an animal should just be data about the animal, the animal itself and the animal's target is passed to a master function that will figure out what happens, and from there the function spits out what happens. If your language supports UFCS (https://en.wikipedia.org/wiki/Nim_(programming_language)#Uniform_Function_Call_Syntax), you can even pretend the master function is possessed by the animal if it makes it easier to think about.
+
+// Write a program of your choice demonstrating how a virtual function works
+
+#include <iostream>
+#include <string>
+using namespace std;
+
+//classes
+class animal {
+ public:
+ int size;
+ virtual void consume(int targetSize) {
+ cout << "this function shouldn't be called, something went wrong";
+ }
+};
+
+class pidgon : public animal {
+ public:
+ void consume(int targetSize) {
+ if (targetSize < size) {
+ cout << "target was consumed\n";
+ }
+ }
+};
+
+int main() {
+ animal *placeholder;
+ pidgon seaPidgon;
+ placeholder = &seaPidgon;
+ placeholder->size = 500;
+ placeholder->consume(400);
+
+}
+/*
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License Version 3 ONLY as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
diff --git a/C++/Week7-Practice1/Ch3_Ex5Data.txt b/C++/Week7-Practice1/Ch3_Ex5Data.txt
new file mode 100644
index 0000000..3cce547
--- /dev/null
+++ b/C++/Week7-Practice1/Ch3_Ex5Data.txt
@@ -0,0 +1,3 @@
+Miller Andrew 65789.87 5
+Green Sheila 75892.56 6
+Sethi Amit 74900.50 6.1
diff --git a/C++/Week7-Practice1/Ch3_Ex5Output.dat b/C++/Week7-Practice1/Ch3_Ex5Output.dat
new file mode 100644
index 0000000..d45ce4a
--- /dev/null
+++ b/C++/Week7-Practice1/Ch3_Ex5Output.dat
@@ -0,0 +1,3 @@
+Andrew Miller 69079.36
+Sheila Green 80446.11
+Amit Sethi 79469.43
diff --git a/C++/Week7-Practice1/practice1.cpp b/C++/Week7-Practice1/practice1.cpp
new file mode 100644
index 0000000..136f842
--- /dev/null
+++ b/C++/Week7-Practice1/practice1.cpp
@@ -0,0 +1,61 @@
+// Name: msglm
+// Date:
+// Program Name:
+// Description:
+
+
+#include <iostream>
+#include <string>
+#include <fstream>
+#include <iomanip>
+using namespace std;
+
+// Named constants
+
+int main() {
+
+ //Variable declaration
+ ifstream inputData;
+ ofstream formattedData;
+ string last, first;
+ double curSal, percent, nuSal;
+
+ //Program title and description for the user
+ cout << "Title: Salary Updater" << endl << "Description: Updates Salary" << endl;
+
+ // User input
+
+ inputData.open("Ch3_Ex5Data.txt");
+ formattedData.open("Ch3_Ex5Output.dat");
+
+ if (inputData) {
+ cout << "Successfully opened file";
+ } else {
+ cout << "ERROR: No File Provided \n";
+ return 1;
+ }
+
+ //TODO find a better way to do this
+ // Calculations
+ while ( true ) {
+ inputData >> last >> first >> curSal >> percent;
+ formattedData << fixed << showpoint << setprecision(2);
+ nuSal = curSal + (curSal * (percent/100));
+ if ( !inputData.eof() ){
+ formattedData << first << " " << last << " " << nuSal << " " << endl;
+ } else {
+ break;
+ }
+ }
+
+ // Output to the screen
+
+ return 0;
+}
+
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/WhileLoopPractice/WhileLoopPractice.cpp b/C++/WhileLoopPractice/WhileLoopPractice.cpp
new file mode 100644
index 0000000..36eb5d0
--- /dev/null
+++ b/C++/WhileLoopPractice/WhileLoopPractice.cpp
@@ -0,0 +1,52 @@
+// Name: msglm
+// Date:
+// Program Name:
+// Description:
+
+
+#include <iostream>
+#include <string>
+#include <iomanip>
+using namespace std;
+
+// Named constants
+
+int main() {
+ //Example 1
+ int iterator = 0;
+
+ while( iterator <= 5 ){
+ cout << iterator << endl;
+ iterator++;
+ }
+
+ //Example 2
+ cout << "output ";
+ iterator = 5;
+ while (iterator > 0) {
+ cout << iterator << " ";
+ iterator--;
+ }
+
+ //Example 3
+ int sentinel = 3;
+ int choice = 0;
+ while (choice != sentinel){
+ cout << "Guess a number between 1 and 5\n";
+ cin >> choice;
+ if (choice < 1 || choice > 5) {
+ cout << "Not a valid input, try again";
+ }
+ cout << endl;
+
+ }
+
+ return 0;
+}
+
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/cinErrorExample/cinErrorExample output(1).docx b/C++/cinErrorExample/cinErrorExample output(1).docx
new file mode 100644
index 0000000..7c8196b
--- /dev/null
+++ b/C++/cinErrorExample/cinErrorExample output(1).docx
Binary files differ
diff --git a/C++/cinErrorExample/cinErrorExamples.cpp b/C++/cinErrorExample/cinErrorExamples.cpp
new file mode 100644
index 0000000..741e987
--- /dev/null
+++ b/C++/cinErrorExample/cinErrorExamples.cpp
@@ -0,0 +1,42 @@
+// Program: cin error examples
+// Ch 3: Input/Output
+
+// The purpose of this program is to look at some possible errors
+// that might occur if a user enters incorrect input
+
+#include <iostream>
+
+using namespace std;
+
+int main()
+{
+ int int1, int2;
+ double dbl;
+ char ch;
+
+ cout << "TESTING INPUT ERRORS" << endl;
+ cout << "Tested by: Anonymous" << endl;
+ cout << "This program is designed to read 2 integer values, followed \n";
+ cout << "by a double value, followed by a character value.\n\n";
+
+ /* INPUT FAILURE & FAIL STATE
+ An attempt to read invalid data, such as trying to put a letter into an int
+ or double, results in input failure. The input stream enters a state called
+ the "fail state." Once it enters fail state, all further I/O statements using
+ that stream are ignored. However, the program continues to execute with whatever
+ values are stored in variables and produces incorrect results.
+ */
+
+ // Run this program several times and purposely provide wrong data types
+ // to see what kind of output is produced.
+ cout << "Input, separated by spaces: ";
+ cin >> int1 >> int2 >> dbl >> ch;
+
+ // Output
+ cout << "int: " << int1 << endl;
+ cout << "int: " << int2 << endl;
+ cout << "Double: " << dbl << endl;
+ cout << "char: " << ch << endl;
+
+ return 0;
+}
diff --git a/C++/cubeSwitch/Ch 4 Cube program instructions.docx b/C++/cubeSwitch/Ch 4 Cube program instructions.docx
new file mode 100644
index 0000000..f59110d
--- /dev/null
+++ b/C++/cubeSwitch/Ch 4 Cube program instructions.docx
Binary files differ
diff --git a/C++/cubeSwitch/cubeSwitch.cpp b/C++/cubeSwitch/cubeSwitch.cpp
new file mode 100644
index 0000000..eef0dd6
--- /dev/null
+++ b/C++/cubeSwitch/cubeSwitch.cpp
@@ -0,0 +1,95 @@
+// Your Name
+// Date:
+// Program Title:
+// Program Description:
+
+#include <iostream>
+#include <string>
+#include <iomanip>
+#include <cmath>
+
+using namespace std;
+
+// Named constants
+
+int main()
+{
+
+ // Variable declaration
+ float sideLength;
+ int choice;
+
+ //Program title and description for the user
+
+ cout << "MENU TEMPLATE with SWITCH CASE" << endl << endl;
+
+ // User input
+
+ cout << "Choose the corresponding number for what task you want to complete." << endl;
+ cout << "1 - perimeter of one side " << endl;
+ cout << "2 - surface area of one side" << endl;
+ cout << "3 - surface area of the entire box" << endl;
+ cout << "4 - volume of the box." << endl;
+ cout << "Enter selected number here: ";
+ cin >> choice;
+
+ // Calculations
+
+ // Output to the screen
+
+ switch (choice)
+ {
+ case 1:
+
+ cout << "Perform task #1 : Perimeter of one side" << endl;
+
+ //Input
+ cout << "Enter the side length: ";
+ cin >> sideLength;
+
+ //Calculate and Output
+ cout << "Side Perimeter Is: " << 4*sideLength << " Cubed Inches \n";
+ break;
+
+ case 2:
+ cout << "Perform task #2 : Surface area of one side" << endl;
+
+ //Input
+ cout << "Enter the side length: ";
+ cin >> sideLength;
+
+ //Calculate and Output
+ cout << "Side Area Is: " << pow(sideLength, 2) << " Cubed Inches \n";
+ break;
+
+ case 3:
+ cout << "Perform task #3 : Surface area of the entire box" << endl;
+
+ //Input
+ cout << "Enter the side length: ";
+ cin >> sideLength;
+
+ //Calculate and Output
+ cout << "Cube Surface Area Is: " << 6*pow(sideLength, 2) << " Cubed Inches \n";
+ break;
+
+ case 4:
+ cout << "Perform task #4 : Volume of the box" << endl;
+
+ //Input
+ cout << "Enter the side length: ";
+ cin >> sideLength;
+
+ //Calculate and Output
+ cout << "Cube Volume Is: " << pow(sideLength, 3) << " Cubed Inches \n";
+
+ return 0;
+
+
+ break;
+
+ default:
+ cout << "Input error; program is terminating" << endl;
+ }
+ return 0;
+}
diff --git a/C++/getlineAndCinPractice/getLineCin.cpp b/C++/getlineAndCinPractice/getLineCin.cpp
new file mode 100644
index 0000000..8f237f0
--- /dev/null
+++ b/C++/getlineAndCinPractice/getLineCin.cpp
@@ -0,0 +1,67 @@
+// Name: msglm
+// Introduction:
+// Description:
+
+
+#include <iostream>
+#include <string>
+#include <iomanip>
+using namespace std;
+int main() {
+
+ string name;
+ string major;
+ string favorite;
+ int gradyear;
+ int year;
+ float GPA;
+ //input
+ cout << "Enter Full Name: ";
+ getline(cin, name);
+
+ cout << "Enter year you started college?: ";
+ cin >> year;
+ cin.ignore();
+
+ cout << "What is your major: ";
+ getline(cin, major);
+
+ cout << "What is your anticipated graduation year?: ";
+ cin >> gradyear;
+ cin.ignore();
+
+ cout << "What is your GPA?: ";
+ cin >> GPA;
+ cin.ignore();
+
+ cout << "What is your favorite subject: ";
+ getline(cin, favorite);
+
+ //output
+
+ //system(cls);
+ //System calls are not portable and are a surefire way of locking your software to one system!
+ //System should be avoided whenever possible for security holes too as unsanitized input could allow shell commands to be executed. Not applicable in this case, but it's a bad habit to get started on.
+ //While this is not as nice looking, it's portable.
+
+ cout << "\033[2J\033[1;1H";
+
+ cout << "Name: " << name << endl;
+ cout << "Year began college: " << year << endl;
+ cout << "Your Major: " << major << endl;
+ cout << "Your anticipated graduation year: " << year << endl;
+ cout << "Your GPA: " << GPA << endl;
+ cout << "Your favorite subject: " << favorite << endl;
+ return 0;
+
+
+
+
+}
+
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/manipulatorPractice/manipulatorPractice.cpp b/C++/manipulatorPractice/manipulatorPractice.cpp
new file mode 100644
index 0000000..c53a14d
--- /dev/null
+++ b/C++/manipulatorPractice/manipulatorPractice.cpp
@@ -0,0 +1,56 @@
+// Manipulator practice
+// Ch 3: Input/Output
+// The purpose of this program is to practice using the some of the manipulators
+// covered in Ch 3: fixed, showpoint, setprecision, setw
+
+#include <iostream>
+#include <string>
+#include <iomanip> // needed to use manipulators
+
+using namespace std;
+
+int main()
+{
+ // Variable declarations
+ string name1, name2;
+ double score1, score2;
+
+ // Program title and description
+ cout << "MANIPULATOR PRACTICE" << endl;
+ cout << "The purpose of this program is to practice using the some of the\n";
+ cout << "manipulators covered in Ch 3: fixed, showpoint, setprecision, setw"
+ << endl << endl;
+
+ // User directions
+ cout << "You will be asked to enter 2 first names and a score for each.\n";
+ cout << "Then you will determine how to print the results in a \n";
+ cout << "column format." << endl << endl;
+
+ // Collect user input
+ cout << "Enter first name for student #1: ";
+ cin >> name1;
+ cout << "Enter score for student #1: ";
+ cin >> score1;
+
+ cout << "Enter first name for student #2: ";
+ cin >> name2;
+ cout << "Enter score for student #2: ";
+ cin >> score2;
+
+ // Instructions for output:
+ // Determine how to print the results in columns
+ // Use column headings to label each column
+ // Determine appropriate alignment for each column
+ // Determine which manipulators are needed to control numerical output
+
+ // Output results
+
+ //This solution doesn't really work with super long names or super long scores
+ //I don't know if this is a problem for this assignment or not
+ //If long names were important, then i'd get the length of the name, add 3 to it, and set that as what setw's value would be.
+ cout << left << setw(13) << "Name" << right << setw(13) << "Score" << endl;
+ cout << left << setw(13) << name1 << right << setw(13) << score1 << endl;
+ cout << left << setw(13) << name2 << right << setw(13) << score2 << endl;
+
+ return 0;
+}
diff --git a/C++/shapeWithFunctions/shapesWithFunctions.cpp b/C++/shapeWithFunctions/shapesWithFunctions.cpp
new file mode 100644
index 0000000..f82861a
--- /dev/null
+++ b/C++/shapeWithFunctions/shapesWithFunctions.cpp
@@ -0,0 +1,135 @@
+// Your Name : msglm
+// Date: Feb-17-2022
+// Program Title: MENU TEMPLATE with IF ELSE
+// Program Description: a program with a menu structure that will allow the user to choose an option to calculate area for a: Rectangle, Circle, and a Triangle
+
+#include <iostream>
+#include <string>
+#include <iomanip>
+#include <cmath>
+
+using namespace std;
+
+//Declare Functions
+//I'd prefer to have these as seperate files or just declaring them at the top
+
+void triangleArea();
+void circleArea();
+void rectArea();
+
+// Named constants
+
+int main() {
+
+ // Variable declaration
+ int choice;
+ char option;
+
+
+ //Program title and description for the user
+
+ cout << "MENU TEMPLATE with IF ELSE" << endl << endl;
+
+ // User input
+ do {
+ do {
+ cout << "Choose the corresponding number for what task you want to complete." << endl;
+ cout << "1 - Perform task #1 : Rectangle area" << endl;
+ cout << "2 - Perform task #2 : Circle area" << endl;
+ cout << "3 - Perform task #3 : Triangle area" << endl;
+ cout << "Enter selected number here: ";
+ cin >> choice;
+
+ if (!cin || choice<1 || choice>4) {
+ cout << "Invalid input selection\n\n";
+ //This will purge the garbage data
+ cin.clear(); //Clears error flag
+ cin.ignore(100, '\n'); //Purges 100 characters of input
+ }
+
+ } while (!cin || choice<1 || choice>4);
+ // Calculations
+
+ // Output to the screen
+
+ //This if-else statement need not exist: a switch statement would be much more optimal
+ if (choice == 1)
+ {
+ rectArea();
+ }
+ else if (choice == 2)
+ {
+ circleArea();
+ }
+ else if (choice == 3)
+ {
+ triangleArea();
+ }
+ else
+ cout << "Terminating" << endl;
+ cout << "Would you like to run again? (Y/N): ";
+ cin >> option;
+ cout << "\033c";
+ } while (option == 'Y' || option == 'y');
+
+ return 0;
+}
+
+ void rectArea() {
+ double height;
+ double width;
+ double area;
+
+ //User Input
+ cout << "Perform task #1 : Rectangle area" << endl;
+ cout << "Input the height in cm: \n";
+ cin >> height;
+
+ cout << "Input the width in cm: \n";
+ cin >> width;
+
+ //Calculation
+ area = height * width;
+
+ //Output
+ cout << "Area of the rectangle is " << area << " cm^2 \n";
+
+ }
+
+ void circleArea() {
+ cout << "Perform task #2 : Circle area" << endl;
+ double inputRadius;
+ string measurement;
+ const double pi = 3.14159;
+
+ //User Input
+ cout << "Please Input the Desired Radius for your Circle in cm: ";
+ cin >> inputRadius;
+
+ //Output
+ cout << "Area of the circle is " << pi*pow(inputRadius, 2) << "cm^2 \n";
+
+ }
+
+ void triangleArea() {
+ double height;
+ double base;
+
+ //User Input
+ cout << "Perform task #3 : Triangle area" << endl;
+ cout << "Input the height in cm: \n";
+ cin >> height;
+
+ cout << "Input the base in cm: \n";
+ cin >> base;
+
+ //Output
+ cout << "Area of the rectangle is " << (height*base)/2 << " cm^2 \n";
+ }
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+
diff --git a/C++/shapes/Ch 4 Shapes program and planning sheet(2).docx b/C++/shapes/Ch 4 Shapes program and planning sheet(2).docx
new file mode 100644
index 0000000..edcc249
--- /dev/null
+++ b/C++/shapes/Ch 4 Shapes program and planning sheet(2).docx
Binary files differ
diff --git a/C++/shapes/shape.cpp b/C++/shapes/shape.cpp
new file mode 100644
index 0000000..bcae77f
--- /dev/null
+++ b/C++/shapes/shape.cpp
@@ -0,0 +1,102 @@
+// Your Name : msglm
+// Date: Feb-17-2022
+// Program Title: MENU TEMPLATE with IF ELSE
+// Program Description: a program with a menu structure that will allow the user to choose an option to calculate area for a: Rectangle, Circle, and a Triangle
+
+#include <iostream>
+#include <string>
+#include <iomanip>
+#include <cmath>
+
+using namespace std;
+
+// Named constants
+
+int main()
+{
+
+ // Variable declaration
+
+ int choice;
+ double area;
+
+ //Program title and description for the user
+
+ cout << "MENU TEMPLATE with IF ELSE" << endl << endl;
+
+ // User input
+
+ cout << "Choose the corresponding number for what task you want to complete." << endl;
+ cout << "1 - Perform task #1 : Rectangle area" << endl;
+ cout << "2 - Perform task #2 : Circle area" << endl;
+ cout << "3 - Perform task #3 : Triangle area" << endl;
+ cout << "Enter selected number here: ";
+ cin >> choice;
+
+ // Calculations
+
+ // Output to the screen
+
+ //This if-else statement need not exist: a switch statement would be much more optimal
+ if (choice == 1)
+ {
+ double height;
+ double width;
+
+ //User Input
+ cout << "Perform task #1 : Rectangle area" << endl;
+ cout << "Input the height in cm: \n";
+ cin >> height;
+
+ cout << "Input the width in cm: \n";
+ cin >> width;
+
+ //Calculation
+ area = height * width;
+
+ //Output
+ cout << "Area of the rectangle is " << area << " cm^2 \n";
+ }
+ else if (choice == 2)
+ {
+ cout << "Perform task #2 : Circle area" << endl;
+ double inputRadius;
+ string measurement;
+ const double pi = 3.14159;
+
+ //User Input
+ cout << "Please Input the Desired Radius for your Circle in cm: ";
+ cin >> inputRadius;
+
+ //Output
+ cout << "Area of the circle is " << pi*pow(inputRadius, 2) << "cm^2 \n";
+
+ }
+ else if (choice == 3)
+ {
+ double height;
+ double base;
+
+ //User Input
+ cout << "Perform task #3 : Triangle area" << endl;
+ cout << "Input the height in cm: \n";
+ cin >> height;
+
+ cout << "Input the base in cm: \n";
+ cin >> base;
+
+ //Output
+ cout << "Area of the rectangle is " << (height*base)/2 << " cm^2 \n";
+ }
+ else
+ cout << "Input error; program terminating" << endl;
+
+ return 0;
+}
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+
diff --git a/C++/shapesWithLoop/shapesWithLoops.cpp b/C++/shapesWithLoop/shapesWithLoops.cpp
new file mode 100644
index 0000000..1b839b3
--- /dev/null
+++ b/C++/shapesWithLoop/shapesWithLoops.cpp
@@ -0,0 +1,118 @@
+// Your Name : msglm
+// Date: Feb-17-2022
+// Program Title: MENU TEMPLATE with IF ELSE
+// Program Description: a program with a menu structure that will allow the user to choose an option to calculate area for a: Rectangle, Circle, and a Triangle
+
+#include <iostream>
+#include <string>
+#include <iomanip>
+#include <cmath>
+
+using namespace std;
+
+// Named constants
+
+int main()
+{
+
+ // Variable declaration
+
+ int choice;
+ double area;
+ char option;
+ //Program title and description for the user
+
+ cout << "MENU TEMPLATE with IF ELSE" << endl << endl;
+
+ // User input
+ do {
+ do {
+ cout << "Choose the corresponding number for what task you want to complete." << endl;
+ cout << "1 - Perform task #1 : Rectangle area" << endl;
+ cout << "2 - Perform task #2 : Circle area" << endl;
+ cout << "3 - Perform task #3 : Triangle area" << endl;
+ cout << "Enter selected number here: ";
+ cin >> choice;
+
+
+
+
+ if (!cin || choice<1 || choice>4) {
+ cout << "Invalid input selection\n\n";
+ //This will purge the garbage data
+ cin.clear(); //Clears error flag
+ cin.ignore(100, '\n'); //Purges 100 characters of input
+ }
+
+ } while (!cin || choice<1 || choice>4);
+ // Calculations
+
+ // Output to the screen
+
+ //This if-else statement need not exist: a switch statement would be much more optimal
+ if (choice == 1)
+ {
+ double height;
+ double width;
+
+ //User Input
+ cout << "Perform task #1 : Rectangle area" << endl;
+ cout << "Input the height in cm: \n";
+ cin >> height;
+
+ cout << "Input the width in cm: \n";
+ cin >> width;
+
+ //Calculation
+ area = height * width;
+
+ //Output
+ cout << "Area of the rectangle is " << area << " cm^2 \n";
+ }
+ else if (choice == 2)
+ {
+ cout << "Perform task #2 : Circle area" << endl;
+ double inputRadius;
+ string measurement;
+ const double pi = 3.14159;
+
+ //User Input
+ cout << "Please Input the Desired Radius for your Circle in cm: ";
+ cin >> inputRadius;
+
+ //Output
+ cout << "Area of the circle is " << pi*pow(inputRadius, 2) << "cm^2 \n";
+
+ }
+ else if (choice == 3)
+ {
+ double height;
+ double base;
+
+ //User Input
+ cout << "Perform task #3 : Triangle area" << endl;
+ cout << "Input the height in cm: \n";
+ cin >> height;
+
+ cout << "Input the base in cm: \n";
+ cin >> base;
+
+ //Output
+ cout << "Area of the rectangle is " << (height*base)/2 << " cm^2 \n";
+ }
+ else
+ cout << "Terminating" << endl;
+ cout << "Would you like to run again? (Y/N): ";
+ cin >> option;
+ cout << "\033c";
+ } while (option == 'Y' || option == 'y');
+
+ return 0;
+}
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+
diff --git a/C++/stepsCount/Steps Count- Input and Output Files.docx b/C++/stepsCount/Steps Count- Input and Output Files.docx
new file mode 100644
index 0000000..06bc353
--- /dev/null
+++ b/C++/stepsCount/Steps Count- Input and Output Files.docx
Binary files differ
diff --git a/C++/stepsCount/inputData.txt b/C++/stepsCount/inputData.txt
new file mode 100644
index 0000000..c2c3a43
--- /dev/null
+++ b/C++/stepsCount/inputData.txt
@@ -0,0 +1 @@
+Sunday 2200 Monday 3060 Tuesday 5840 Wednesday 3230 Thursday 4584 Friday 3400 Saturday 1870
diff --git a/C++/stepsCount/stepCount.cpp b/C++/stepsCount/stepCount.cpp
new file mode 100644
index 0000000..0a89f98
--- /dev/null
+++ b/C++/stepsCount/stepCount.cpp
@@ -0,0 +1,94 @@
+// Name: msglm
+// Date: Feb-14-2021
+// Program Name: Step Count
+// Description: Takes in the amount of steps you took through a week and averages them together
+
+
+#include <iostream>
+#include <string>
+#include <fstream>
+#include <iomanip>
+#include <vector>
+using namespace std;
+
+// Named constants
+
+int main() {
+
+ //Variable declaration
+ ifstream inputData;
+ ofstream stepsFormatted;
+ string tempDay = "-1";
+ int tempSteps = -1;
+ int epoch;
+ int averageSteps;
+ int totalSteps;
+ vector<int> stepPendingAverage; //Vector was chosen for its ease of being able to append
+
+ //Program title and description for the user
+ cout << "Title: Step Count" << endl << "Description: Takes in the amount of steps you took through a week and averages them together" << endl;
+
+ // User input
+ // Dealing with input/output files
+ inputData.open("inputData.txt");
+ stepsFormatted.open("stepsFormated.txt");
+
+ //Create and set up file's formatting + columns
+ stepsFormatted << fixed << showpoint << setprecision(2);
+ stepsFormatted << setw(17) << left << "Day " << setw(8) << "Steps" << endl;
+ //Reading from the file
+
+ //This will loop over so long as the file is not empty
+ while( !inputData.eof() ) {
+
+ //Test to see if tempDay and tempSteps is assigned to valid input
+ if (tempDay != "-1" && tempSteps != -1) {
+ //if tempDay and tempSteps is valid, then write to the file what is desired
+ stepsFormatted << setw(17) << left << tempDay << setw(8) << tempSteps << endl;
+ //invalidate the input so it may be wrote over again
+ tempDay = -1;
+ tempSteps = -1;
+ //TODO find a better way to do this; there may be a time where -1 is valid input.
+ }
+
+ //If the input is a day, write the day name to tempDay
+ if (epoch % 2 == 0) {
+ inputData >> tempDay;
+ } else {
+ //Otherwise, is a number of steps and write that number to tempSteps
+ inputData >> tempSteps;
+ //also append number of steps to the temporary pending steps array
+ stepPendingAverage.push_back(tempSteps);
+
+ }
+ //Increase the epoch by 1, showing that a pair of day and steps has been read
+ epoch++;
+ }
+
+ // Calculations
+
+ // Obtaining total number of steps
+ for(int iteration=0; iteration < stepPendingAverage.size(); iteration++) {
+ totalSteps = totalSteps + stepPendingAverage[iteration];
+ //Obtain Average
+ averageSteps = totalSteps/stepPendingAverage.size();
+ }
+ //Writing average to file
+ stepsFormatted << setw(17) << left << "Average" << setw(8) << averageSteps << "steps per day" << endl;
+
+ //Close files
+ inputData.close();
+ stepsFormatted.close();
+
+ // Output to the screen
+ cout << "Please Check stepsFormatted.txt file" << endl;
+
+ return 0;
+}
+
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/stepsCount/stepsFormated.txt b/C++/stepsCount/stepsFormated.txt
new file mode 100644
index 0000000..e808fec
--- /dev/null
+++ b/C++/stepsCount/stepsFormated.txt
@@ -0,0 +1,9 @@
+Day Steps
+Sunday 2200
+Monday 3060
+Tuesday 5840
+Wednesday 3230
+Thursday 4584
+Friday 3400
+Saturday 1870
+Average 3454 steps per day
diff --git a/C++/studentScore/studentScore.cpp b/C++/studentScore/studentScore.cpp
new file mode 100644
index 0000000..b40229a
--- /dev/null
+++ b/C++/studentScore/studentScore.cpp
@@ -0,0 +1,73 @@
+// Name: msglm
+// Date:
+// Introduction:
+// Description:
+
+
+#include <iostream>
+#include <string>
+#include <fstream>
+#include <iomanip>
+using namespace std;
+
+// Named constants
+
+int main() {
+
+ //Variable declaration
+ ifstream inFile;
+ ofstream outFile;
+ string name1, name2, name3;
+ double test1, test2, test3;
+ double test4, test5, test6;
+ double test7, test8, test9;
+ double average1, average2, average3;
+
+ //Program title and description for the user
+ //cout << "Title: " << endl << "Description: " << endl;
+
+ // User input
+ // Dealing with input/output files
+ inFile.open("studentScore.txt");
+ outFile.open("testavg.out");
+
+ //Reading from the file
+ getline(inFile, name1);
+ inFile >> test1 >> test2 >> test3;
+ inFile.ignore();
+
+ getline(inFile, name2);
+ inFile >> test4 >> test5 >> test6;
+ inFile.ignore();
+
+ getline(inFile, name3);
+ inFile >> test7 >> test8 >> test9;
+ inFile.ignore();
+
+ // Calculations
+ average1 = (test1+test2+test3)/3.0;
+ average2 = (test4+test5+test6)/3.0;
+ average3 = (test7+test8+test9)/3.0;
+
+ // Output to the screen
+
+ outFile << fixed << showpoint << setprecision(2);
+ outFile << setw(17) << left << "Name: " << setw(8) << "Test 1" << setw(8) << "Test 2" << setw(8) << "Test 3" << setw(8) << "Average" << endl;
+ outFile << setw(17) << left << name1 << setw(8) << test1 << setw(8) << test2 << setw(8) << test3 << setw(8) << average1 << endl;
+ outFile << setw(17) << left << name2 << setw(8) << test4 << setw(8) << test5 << setw(8) << test6 << setw(8) << average2 << endl;
+ outFile << setw(17) << left << name3 << setw(8) << test7 << setw(8) << test8 << setw(8) << test9 << setw(8) << average3 << endl;
+
+ inFile.close();
+ outFile.close();
+
+ cout << "Please Check testavg.out file" << endl;
+
+ return 0;
+}
+
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
diff --git a/C++/studentScore/studentScore.txt b/C++/studentScore/studentScore.txt
new file mode 100644
index 0000000..647019e
--- /dev/null
+++ b/C++/studentScore/studentScore.txt
@@ -0,0 +1,6 @@
+Indira Dutta
+67.2 58.54 98.3
+Anonymous Anonymous
+30.4 90.4 75.4
+Jarvis Henderson
+40.3 24.5 90.4
diff --git a/C++/studentScore/testavg.out b/C++/studentScore/testavg.out
new file mode 100644
index 0000000..8624224
--- /dev/null
+++ b/C++/studentScore/testavg.out
@@ -0,0 +1,4 @@
+Name: Test 1 Test 2 Test 3 Average
+Indira Dutta 67.20 58.54 98.30 74.68
+Anonymous Anonymous 30.40 90.40 75.40 65.40
+Jarvis Henderson 40.30 24.50 90.40 51.73
diff --git a/C++/sumOfRange/Sum of Range program instruction.docx b/C++/sumOfRange/Sum of Range program instruction.docx
new file mode 100644
index 0000000..abc6187
--- /dev/null
+++ b/C++/sumOfRange/Sum of Range program instruction.docx
Binary files differ