diff options
| author | James Lawrance <[email protected]> | 2021-12-08 14:43:41 -0800 |
|---|---|---|
| committer | James Lawrance <[email protected]> | 2021-12-08 14:43:41 -0800 |
| commit | 747d1f59dea35324711c74b41ae6b54e1dae6a7c (patch) | |
| tree | ff708f7abac7ebf0c172da5f584518281456460a | |
| parent | Add online IDE url (diff) | |
| download | cst116-proj3-jemersonlawrance-master.tar.xz cst116-proj3-jemersonlawrance-master.zip | |
| -rw-r--r-- | CST116F2021-Proj3/Agile Questions.txt | 35 | ||||
| -rw-r--r-- | CST116F2021-Proj3/CST116F2021-Proj3.cpp | 115 | ||||
| -rw-r--r-- | CST116F2021-Proj3/CST116F2021-Proj3.vcxproj | 11 | ||||
| -rw-r--r-- | CST116F2021-Proj3/CST116F2021-Proj3.vcxproj.filters | 25 | ||||
| -rw-r--r-- | CST116F2021-Proj3/Documentation.txt | 13 | ||||
| -rw-r--r-- | CST116F2021-Proj3/Functions.cpp | 49 | ||||
| -rw-r--r-- | CST116F2021-Proj3/Header.h | 9 | ||||
| -rw-r--r-- | CST116F2021-Proj3/Notes from Meetings.txt | 10 | ||||
| -rw-r--r-- | CST116F2021-Proj3/Pseudocode.txt | 135 | ||||
| -rw-r--r-- | CST116F2021-Proj3/Testing Plan and Runs.txt | 160 |
10 files changed, 550 insertions, 12 deletions
diff --git a/CST116F2021-Proj3/Agile Questions.txt b/CST116F2021-Proj3/Agile Questions.txt new file mode 100644 index 0000000..477ba27 --- /dev/null +++ b/CST116F2021-Proj3/Agile Questions.txt @@ -0,0 +1,35 @@ +1. + +-What SPECIFIC task will you complete in the next half hour? +I will come up with a plan with Kaeden to begin working on pseudocode +-What do you know about this SPECIFIC task? +I know the problem in the textbook that we have to work on +-What DON'T you know about this SPECIFIC task? +I don't know how Kaeden and I should divide the work out among the two +of us + +2. +-What SPECIFIC task will you complete in the next half hour? +I will finish the psuedocode for my sections of the program +-What do you know about this SPECIFIC task? +I know what my sections of the program do +-What DON'T you know about this SPECIFIC task? +I don't know where we're going to put the menu of our program + +3. +-What SPECIFIC task will you complete in the next half hour? +I will begin coding my sections of the program +-What do you know about this SPECIFIC task? +I know how to translate my pseudocode into C++ code +-What DON'T you know about this SPECIFIC task? +I don't know how I am going to combine my code with Kaeden's + +4. +-What SPECIFIC task will you complete in the next half hour? +I will fix any errors in the final code that occured when Kaeden put our +sections together +-What do you know about this SPECIFIC task? +I know how to use the debugger to look for possible logical errors +-What DON'T you know about this SPECIFIC task? +I don't know what we should do to test the program + diff --git a/CST116F2021-Proj3/CST116F2021-Proj3.cpp b/CST116F2021-Proj3/CST116F2021-Proj3.cpp index 93999c0..ebc56fb 100644 --- a/CST116F2021-Proj3/CST116F2021-Proj3.cpp +++ b/CST116F2021-Proj3/CST116F2021-Proj3.cpp @@ -1,20 +1,111 @@ -// CST116F2021-Proj3.cpp : This file contains the 'main' function. Program execution begins and ends there. -// +#include "Header.h" + +//HEADER +#pragma once #include <iostream> +#include <iomanip> + +using namespace std; + +//function prototypes +void getNewMatrices(); +void addMatrices(); +void multiplyMatrices(); + +float Matrix1[3][3]; +float Matrix2[3][3]; +//kaeden int main() { - std::cout << "Hello World!\n"; + int menuChoice = 0; + while (menuChoice != 4) + { + cout << "~The Matrix Machine~\n1) Get new matrices.\n2) Multiply Matrices\n3) Add Matrices\n4) Exit\nWhat would you like to do? "; + cin >> menuChoice; + switch (menuChoice) + { + case 1: + getNewMatrices(); + break; + case 2: + multiplyMatrices(); + break; + case 3: + addMatrices(); + break; + case 4: + break; + default: + cout << "Invalid menu choice."; + } + } + cout << "\nGoodbye!\n"; +} + +//kaeden +void multiplyMatrices() +{ + float matrixProduct[3][3]; + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 3; j++) + { + matrixProduct[i][j] = (Matrix1[i][0] * Matrix2[0][j]) + (Matrix1[i][1] * Matrix2[1][j]) + (Matrix1[i][2] * Matrix2[2][j]); + } + } + cout << "|" << matrixProduct[0][0] << setw(8) << matrixProduct[0][1] << setw(8) << matrixProduct[0][2] << "|\n"; + cout << "|" << matrixProduct[1][0] << setw(8) << matrixProduct[1][1] << setw(8) << matrixProduct[1][2] << "|\n"; + cout << "|" << matrixProduct[2][0] << setw(8) << matrixProduct[2][1] << setw(8) << matrixProduct[2][2] << "|\n"; + return; } -// Run program: Ctrl + F5 or Debug > Start Without Debugging menu -// Debug program: F5 or Debug > Start Debugging menu +//james +void getNewMatrices() +{ + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 3; j++) + { + cout << "Value " << (i * 3) + (j + 1) << " of Matrix 1: "; + cin >> Matrix1[i][j]; + } + } + + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 3; j++) + { + cout << "Value " << (i * 3) + (j + 1) << " of Matrix 2: "; + cin >> Matrix2[i][j]; + } + } +} + +//james +void addMatrices() +{ + float displayMatrix[3][3]; + char upperCornerL = 218, upperCornerR = 191, lowerCornerL = 192, lowerCornerR = 217; + + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 3; j++) + { + displayMatrix[i][j] = Matrix1[i][j] + Matrix2[i][j]; + } + } -// Tips for Getting Started: -// 1. Use the Solution Explorer window to add/manage files -// 2. Use the Team Explorer window to connect to source control -// 3. Use the Output window to see build output and other messages -// 4. Use the Error List window to view errors -// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project -// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file + cout << upperCornerL << setw(21) << upperCornerR + << endl; + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 3; j++) + { + cout << setw(6) << displayMatrix[i][j]; + } + cout << endl; + } + cout << lowerCornerL << setw(21) << lowerCornerR << endl; +}
\ No newline at end of file diff --git a/CST116F2021-Proj3/CST116F2021-Proj3.vcxproj b/CST116F2021-Proj3/CST116F2021-Proj3.vcxproj index e0992e3..118acc3 100644 --- a/CST116F2021-Proj3/CST116F2021-Proj3.vcxproj +++ b/CST116F2021-Proj3/CST116F2021-Proj3.vcxproj @@ -140,6 +140,17 @@ </ItemDefinitionGroup> <ItemGroup> <ClCompile Include="CST116F2021-Proj3.cpp" /> + <ClCompile Include="Functions.cpp" /> + </ItemGroup> + <ItemGroup> + <Text Include="Pseudocode.txt" /> + <Text Include="Documentation.txt" /> + <Text Include="Notes from Meetings.txt" /> + <Text Include="Testing Plan and Runs.txt" /> + <Text Include="Agile Questions.txt" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="Header.h" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/CST116F2021-Proj3/CST116F2021-Proj3.vcxproj.filters b/CST116F2021-Proj3/CST116F2021-Proj3.vcxproj.filters index b41b4b5..2276c8c 100644 --- a/CST116F2021-Proj3/CST116F2021-Proj3.vcxproj.filters +++ b/CST116F2021-Proj3/CST116F2021-Proj3.vcxproj.filters @@ -18,5 +18,30 @@ <ClCompile Include="CST116F2021-Proj3.cpp"> <Filter>Source Files</Filter> </ClCompile> + <ClCompile Include="Functions.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <Text Include="Pseudocode.txt"> + <Filter>Source Files</Filter> + </Text> + <Text Include="Documentation.txt"> + <Filter>Source Files</Filter> + </Text> + <Text Include="Notes from Meetings.txt"> + <Filter>Source Files</Filter> + </Text> + <Text Include="Testing Plan and Runs.txt"> + <Filter>Source Files</Filter> + </Text> + <Text Include="Agile Questions.txt"> + <Filter>Source Files</Filter> + </Text> + </ItemGroup> + <ItemGroup> + <ClInclude Include="Header.h"> + <Filter>Header Files</Filter> + </ClInclude> </ItemGroup> </Project>
\ No newline at end of file diff --git a/CST116F2021-Proj3/Documentation.txt b/CST116F2021-Proj3/Documentation.txt new file mode 100644 index 0000000..de7ec5e --- /dev/null +++ b/CST116F2021-Proj3/Documentation.txt @@ -0,0 +1,13 @@ +Contact Information - + +James Lawrance - [email protected] +Kaeden Grubb - [email protected] + +Meeting Plan - + +Our meeting plan is 12:00PM to 1:00PM every three days. We will meet via Zoom. + +Work Dividing - + +We will divide work equally among the two of us. For the four main sections of the +program, Kaeden and I each complete two.
\ No newline at end of file diff --git a/CST116F2021-Proj3/Functions.cpp b/CST116F2021-Proj3/Functions.cpp new file mode 100644 index 0000000..4a04137 --- /dev/null +++ b/CST116F2021-Proj3/Functions.cpp @@ -0,0 +1,49 @@ +#include "Header.h" + +//function definitions +void getNewMatrices(float Matrix1[3][3], float Matrix2[3][3]) +{ + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 3; j++) + { + cout << "Value " << (i*3) + (j+1) << " of Matrix 1: "; + cin >> Matrix1[i][j]; + } + } + + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 3; j++) + { + cout << "Value " << (i * 3) + (j + 1) << " of Matrix 2: "; + cin >> Matrix2[i][j]; + } + } +} + +void addMatrices(float Matrix1[3][3], float Matrix2[3][3]) +{ + float displayMatrix[3][3]; + char upperCornerL = 218, upperCornerR = 191, lowerCornerL = 192, lowerCornerR = 217; + + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 3; j++) + { + displayMatrix[i][j] = Matrix1[i][j] + Matrix2[i][j]; + } + } + + cout << upperCornerL << setw(21) << upperCornerR + << endl; + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 3; j++) + { + cout << setw(6) << displayMatrix[i][j]; + } + cout << endl; + } + cout << lowerCornerL << setw(21) << lowerCornerR; +}
\ No newline at end of file diff --git a/CST116F2021-Proj3/Header.h b/CST116F2021-Proj3/Header.h new file mode 100644 index 0000000..8584f4e --- /dev/null +++ b/CST116F2021-Proj3/Header.h @@ -0,0 +1,9 @@ +#pragma once +#include <iostream> +#include <iomanip> + +using namespace std; + +//function prototypes +void getNewMatrices(float Matrix1[3][3], float Matrix2[3][3]); +void addMatrices(float Matrix1[3][3], float Matrix2[3][3]);
\ No newline at end of file diff --git a/CST116F2021-Proj3/Notes from Meetings.txt b/CST116F2021-Proj3/Notes from Meetings.txt new file mode 100644 index 0000000..1f8cd01 --- /dev/null +++ b/CST116F2021-Proj3/Notes from Meetings.txt @@ -0,0 +1,10 @@ +Meeting 1 - +We met Nov. 27th @ 12:00PM. +We examined the project and decided how we should divide the work up equally. +Then, we began and finished our pseudocode for each of our sections. + +Meeting 2 - +We met Nov. 30th @ 12:00PM. +We translated our pseudocode into C++ code and created functional +programs for each of our sections. Then, I sent my code over to Kaeden +so he could merge the two programs together.
\ No newline at end of file diff --git a/CST116F2021-Proj3/Pseudocode.txt b/CST116F2021-Proj3/Pseudocode.txt new file mode 100644 index 0000000..e60b5eb --- /dev/null +++ b/CST116F2021-Proj3/Pseudocode.txt @@ -0,0 +1,135 @@ +James Lawrance and Kaeden Grubb Project 3 Pseudocode +---------------------------------------------------- +//Preprocessor/Global (Kaeden) +<include #iostream> + +using namespace std; + + + +void getMatrices(int matrice1, int matrice2); + +void addMatrices(int matrice1, int matrice2); + +void multiplyMatrices(int matrice1, int matrice2); + +//Menu (Kaeden) + +int matrice1[3][3]; + +int matrice2[3][3]; + + + +main() + +{ + +bool exit = false; + +int choice; + +while (exit = false) + +print menu + +cin choice + +switch(choice) + +case 1: + +getMatrices(); + +case 2: + +addMatrices(); + +case 3: + +multiplyMatrices(); + +case 4: + +exit = true; + +} + +//Get New Matrices (James) + +Get User Input starting at Matrix1[0][0], ending at Matrix1[2][2], filling whole array +Get User Input starting at Matrix2[0][0], ending at Matrix2[2][2], filling whole array + +Return to Menu + +//Add Matrices (James) + +Initialize Float Array "DisplayMatrix" at [3][3] + +For loop with counter that terminates once counter is greater than 2, counter increases by 1 each loop + For loop with counter2 that terminates once counter2 is greater than 2, counter2 increases by 1 each loop + DisplayMatrix[counter][counter2] = Matrix1[counter][counter2] + Matrix2[counter][counter2] + +Print Upper Corner Left +Print Spacing +Print Upper Corner Right + +For loop with counter that terminates once counter is greater than 2, counter increases by 1 each loop + Print Spacing + For loop with counter2 that terminates once counter2 is greater than 2, counter2 increases by 1 each loop + Print DisplayMatrix[counter][counter2] + Print Spacing + End line + +Print Lower Corner Left +Print Spacing +Print Lower Corner Right + +Return to Menu + +//Multiply Matrices (Kaeden) + +void multiplyMatrices(int matrice1, int matrice2) + +{ + +int product[3][3]; + +for (int i = 0, i < 3, i++) + +{ + +for (int j = 0, j < 3, j++) + +{ + +product[i][j] = (matrice1[i][1] * matrice2[j][1]) + matrice1[i][2] * matrice2[j][2]) + matrice1[i][3] * matrice2[j][3]); + +} + +} + +print product; + +return; + +} + + + +James: + +void getMatrices(int matrice1, int matrice2) + +{ + +} + +void addMatrices(int matrice1, int matrice2) + +{ + +} + + + diff --git a/CST116F2021-Proj3/Testing Plan and Runs.txt b/CST116F2021-Proj3/Testing Plan and Runs.txt new file mode 100644 index 0000000..72cf7e4 --- /dev/null +++ b/CST116F2021-Proj3/Testing Plan and Runs.txt @@ -0,0 +1,160 @@ +Kaeden and I tested the portions of the program we were working on +individually + +Once we put the full program together, I edited out the major issues. +-------------------------------------------------------------------- +RUNS + +output 1 - + +~The Matrix Machine~ +1) Get new matrices. +2) Multiply Matrices +3) Add Matrices +4) Exit +What would you like to do? 1 +Value 1 of Matrix 1: 3 +Value 2 of Matrix 1: 3 +Value 3 of Matrix 1: 3 +Value 4 of Matrix 1: 3 +Value 5 of Matrix 1: 3 +Value 6 of Matrix 1: 3 +Value 7 of Matrix 1: 3 +Value 8 of Matrix 1: 3 +Value 9 of Matrix 1: 3 +Value 1 of Matrix 2: 1 +Value 2 of Matrix 2: 1 +Value 3 of Matrix 2: 1 +Value 4 of Matrix 2: 2 +Value 5 of Matrix 2: 2 +Value 6 of Matrix 2: 2 +Value 7 of Matrix 2: 3 +Value 8 of Matrix 2: 3 +Value 9 of Matrix 2: 3 +~The Matrix Machine~ +1) Get new matrices. +2) Multiply Matrices +3) Add Matrices +4) Exit +What would you like to do? 3 +? ? + 4 4 4 + 5 5 5 + 6 6 6 +? ? +~The Matrix Machine~ +1) Get new matrices. +2) Multiply Matrices +3) Add Matrices +4) Exit +What would you like to do? 2 +|18 18 18| +|18 18 18| +|18 18 18| +~The Matrix Machine~ +1) Get new matrices. +2) Multiply Matrices +3) Add Matrices +4) Exit +What would you like to do? 1 +Value 1 of Matrix 1: 9 +Value 2 of Matrix 1: 8 +Value 3 of Matrix 1: 7 +Value 4 of Matrix 1: 6 +Value 5 of Matrix 1: 5 +Value 6 of Matrix 1: 4 +Value 7 of Matrix 1: 3 +Value 8 of Matrix 1: 2 +Value 9 of Matrix 1: 1 +Value 1 of Matrix 2: 1 +Value 2 of Matrix 2: 10 +Value 3 of Matrix 2: 100 +Value 4 of Matrix 2: 1000 +Value 5 of Matrix 2: 100 +Value 6 of Matrix 2: 10 +Value 7 of Matrix 2: 1 +Value 8 of Matrix 2: 0 +Value 9 of Matrix 2: 0 +~The Matrix Machine~ +1) Get new matrices. +2) Multiply Matrices +3) Add Matrices +4) Exit +What would you like to do? 3 +? ? + 10 18 107 + 1006 105 14 + 4 2 1 +? ? +~The Matrix Machine~ +1) Get new matrices. +2) Multiply Matrices +3) Add Matrices +4) Exit +What would you like to do? 2 +|8016 890 980| +|5010 560 650| +|2004 230 320| +~The Matrix Machine~ +1) Get new matrices. +2) Multiply Matrices +3) Add Matrices +4) Exit +What would you like to do? 4 + +Goodbye! + +output 2 - + +~The Matrix Machine~ +1) Get new matrices. +2) Multiply Matrices +3) Add Matrices +4) Exit +What would you like to do? 2 +|0 0 0| +|0 0 0| +|0 0 0| +~The Matrix Machine~ +1) Get new matrices. +2) Multiply Matrices +3) Add Matrices +4) Exit +What would you like to do? 3 +? ? + 0 0 0 + 0 0 0 + 0 0 0 +? ? +~The Matrix Machine~ +1) Get new matrices. +2) Multiply Matrices +3) Add Matrices +4) Exit +What would you like to do? 1 +Value 1 of Matrix 1: 1 +Value 2 of Matrix 1: 1 +Value 3 of Matrix 1: 1 +Value 4 of Matrix 1: 1 +Value 5 of Matrix 1: 1 +Value 6 of Matrix 1: 1 +Value 7 of Matrix 1: 1 +Value 8 of Matrix 1: 1 +Value 9 of Matrix 1: 1 +Value 1 of Matrix 2: 1 +Value 2 of Matrix 2: 1 +Value 3 of Matrix 2: 1 +Value 4 of Matrix 2: 1 +Value 5 of Matrix 2: 1 +Value 6 of Matrix 2: 1 +Value 7 of Matrix 2: 1 +Value 8 of Matrix 2: 1 +Value 9 of Matrix 2: 1 +~The Matrix Machine~ +1) Get new matrices. +2) Multiply Matrices +3) Add Matrices +4) Exit +What would you like to do? 4 + +Goodbye!
\ No newline at end of file |