diff --git a/1st-Semester-Fall-2021/CSNP/.vscode/launch.json b/1st-Semester-Fall-2021/CSNP/.vscode/launch.json new file mode 100755 index 0000000..1b4e2e6 --- /dev/null +++ b/1st-Semester-Fall-2021/CSNP/.vscode/launch.json @@ -0,0 +1,29 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "g++.exe - Build and debug active file", + "type": "cppdbg", + "request": "launch", + "program": "${fileDirname}\\${fileBasenameNoExtension}.exe", + "args": [], + "stopAtEntry": false, + "cwd": "${fileDirname}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "miDebuggerPath": "C:\\Program Files (x86)\\mingw-w64\\i686-8.1.0-posix-dwarf-rt_v6-rev0\\mingw32\\bin\\gdb.exe", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ], + "preLaunchTask": "C/C++: g++.exe build active file" + } + ] +} \ No newline at end of file diff --git a/1st-Semester-Fall-2021/CSNP/.vscode/settings.json b/1st-Semester-Fall-2021/CSNP/.vscode/settings.json new file mode 100755 index 0000000..8917c8d --- /dev/null +++ b/1st-Semester-Fall-2021/CSNP/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "files.associations": { + "ostream": "cpp", + "iostream": "cpp" + }, + "C_Cpp.errorSquiggles": "Disabled" +} \ No newline at end of file diff --git a/1st-Semester-Fall-2021/CSNP/.vscode/tasks.json b/1st-Semester-Fall-2021/CSNP/.vscode/tasks.json new file mode 100755 index 0000000..3f1e373 --- /dev/null +++ b/1st-Semester-Fall-2021/CSNP/.vscode/tasks.json @@ -0,0 +1,27 @@ +{ + "tasks": [ + { + "type": "cppbuild", + "label": "C/C++: g++.exe build active file", + "command": "C:\\Program Files (x86)\\mingw-w64\\i686-8.1.0-posix-dwarf-rt_v6-rev0\\mingw32\\bin\\g++.exe", + "args": [ + "-g", + "${file}", + "-o", + "${fileDirname}\\${fileBasenameNoExtension}.exe" + ], + "options": { + "cwd": "${fileDirname}" + }, + "problemMatcher": [ + "$gcc" + ], + "group": { + "kind": "build", + "isDefault": true + }, + "detail": "Task generated by Debugger." + } + ], + "version": "2.0.0" +} \ No newline at end of file diff --git a/1st-Semester-Fall-2021/CSNP/BinaryConverter/BinaryConverter.cpp b/1st-Semester-Fall-2021/CSNP/BinaryConverter/BinaryConverter.cpp new file mode 100755 index 0000000..57dd5e3 --- /dev/null +++ b/1st-Semester-Fall-2021/CSNP/BinaryConverter/BinaryConverter.cpp @@ -0,0 +1,44 @@ +/*************************************************************** +* Name: Aidan Sharpe +* Course: Computer Science & Programming +* Class: CS04103 Section: 2 +* Assignment Date: 9/8/2021 +* File Name: BinaryConverter.cpp +***************************************************************** +* ID: Lab 0 Problem 1 +* Purpose: Convert an user-entered integer to a binary string +*****************************************************************/ + +#include +#include +using namespace std; + +int main() +{ + int x, n, k, a, c; + + + // Data collection + cout << "Enter an integer in the decimal number system: "; + cin >> x; + cout << "Binary value of the number is: "; + + //calculate the number of bits being used + for ( a = 1; n != 0; a++ ) + { + n = n / 2; + } + a = a - 2; + + // get each bit in the integer by bitshifting it one place to the left and reading the ones place for each bit in the number + for ( c = a; c >= 0; c-- ) + { + k = x >> c; + if ( k & 1 ) + cout << "1"; + else + cout << "0"; + } + + return 0; +} \ No newline at end of file diff --git a/1st-Semester-Fall-2021/CSNP/BinaryConverter/BinaryConverter.exe b/1st-Semester-Fall-2021/CSNP/BinaryConverter/BinaryConverter.exe new file mode 100755 index 0000000..6e24821 Binary files /dev/null and b/1st-Semester-Fall-2021/CSNP/BinaryConverter/BinaryConverter.exe differ diff --git a/1st-Semester-Fall-2021/CSNP/CSNP-04103-Final-Project/wxBase/Release1.0.zip b/1st-Semester-Fall-2021/CSNP/CSNP-04103-Final-Project/wxBase/Release1.0.zip new file mode 100644 index 0000000..aca7ee0 Binary files /dev/null and b/1st-Semester-Fall-2021/CSNP/CSNP-04103-Final-Project/wxBase/Release1.0.zip differ diff --git a/1st-Semester-Fall-2021/CSNP/CSNP-04103-Final-Project/wxBase/wxBase.sln b/1st-Semester-Fall-2021/CSNP/CSNP-04103-Final-Project/wxBase/wxBase.sln new file mode 100644 index 0000000..edf857d --- /dev/null +++ b/1st-Semester-Fall-2021/CSNP/CSNP-04103-Final-Project/wxBase/wxBase.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31912.275 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxBase", "wxBase\wxBase.vcxproj", "{128B02C4-4E1C-4F63-8A0A-B32DD6B4A54B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {128B02C4-4E1C-4F63-8A0A-B32DD6B4A54B}.Debug|x64.ActiveCfg = Debug|x64 + {128B02C4-4E1C-4F63-8A0A-B32DD6B4A54B}.Debug|x64.Build.0 = Debug|x64 + {128B02C4-4E1C-4F63-8A0A-B32DD6B4A54B}.Debug|x86.ActiveCfg = Debug|Win32 + {128B02C4-4E1C-4F63-8A0A-B32DD6B4A54B}.Debug|x86.Build.0 = Debug|Win32 + {128B02C4-4E1C-4F63-8A0A-B32DD6B4A54B}.Release|x64.ActiveCfg = Release|x64 + {128B02C4-4E1C-4F63-8A0A-B32DD6B4A54B}.Release|x64.Build.0 = Release|x64 + {128B02C4-4E1C-4F63-8A0A-B32DD6B4A54B}.Release|x86.ActiveCfg = Release|Win32 + {128B02C4-4E1C-4F63-8A0A-B32DD6B4A54B}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {133E650D-4238-4F51-81BB-171D8152659E} + EndGlobalSection +EndGlobal diff --git a/1st-Semester-Fall-2021/CSNP/CSNP-04103-Final-Project/wxBase/wxBase/README.txt b/1st-Semester-Fall-2021/CSNP/CSNP-04103-Final-Project/wxBase/wxBase/README.txt new file mode 100644 index 0000000..a12595f --- /dev/null +++ b/1st-Semester-Fall-2021/CSNP/CSNP-04103-Final-Project/wxBase/wxBase/README.txt @@ -0,0 +1,24 @@ +/************************************************************************* +* Name: Aidan Sharpe +* Course: Computer Science & Programming +* Class: CS04103 Section: 6 +* Assignment Date: 12.13.2021 +* +* File Names: cApp.h | cApp.cpp +* cMain.h | cMain.cpp +* ReservationDialog.h | ReservationDialog.cpp +* Restaurant.h | Restaurant.cpp +* README.txt | +*************************************************************************** +* ID: CSNP Final Project +* Purpose: A reservation management system +* Key Features: +* - Create a walk-in reservation for a party of people +* - Create a reservation for a party of people at a certain time +* - See if tables are reserved or not +* - Check wait times for different party sizes +* - Edit reservations (change any component) +* - Add additional tables to the restaurant +* +* Created on top of wxWidgets cross-platform GUI framework for C++ +***************************************************************************/ \ No newline at end of file diff --git a/1st-Semester-Fall-2021/CSNP/CSNP-04103-Final-Project/wxBase/wxBase/ReservationDialog.cpp b/1st-Semester-Fall-2021/CSNP/CSNP-04103-Final-Project/wxBase/wxBase/ReservationDialog.cpp new file mode 100644 index 0000000..819424e --- /dev/null +++ b/1st-Semester-Fall-2021/CSNP/CSNP-04103-Final-Project/wxBase/wxBase/ReservationDialog.cpp @@ -0,0 +1,64 @@ +#include "ReservationDialog.h" + +using namespace std; + +wxBEGIN_EVENT_TABLE(ReservationDialog, wxDialog) + EVT_BUTTON(10004, Ok) + EVT_BUTTON(10005, Cancel) +wxEND_EVENT_TABLE() + +ReservationDialog::ReservationDialog() : wxDialog(nullptr, wxID_ANY, "Reserve Table", wxPoint(100, 100), wxSize(260, 240)) +{ + lblName = new wxStaticText(this, wxID_ANY, "*Reservation Name:", wxPoint(10, 10)); + lblNumber = new wxStaticText(this, wxID_ANY, "*Phone Number:", wxPoint(10, 40)); + lblSize = new wxStaticText(this, wxID_ANY, "*Party Size:", wxPoint(10, 70)); + lblTime = new wxStaticText(this, wxID_ANY, "Reservation Time:", wxPoint(10, 100)); + lblDate = new wxStaticText(this, wxID_ANY, "Reservation Date:", wxPoint(10, 130)); + + txtName = new wxTextCtrl(this, wxID_ANY, "", wxPoint(120, 10)); + txtNumber = new wxTextCtrl(this, wxID_ANY, "", wxPoint(120, 40)); + txtSize = new wxTextCtrl(this, wxID_ANY, "", wxPoint(120, 70)); + txtTime = new wxTextCtrl(this, wxID_ANY, "", wxPoint(120, 100)); + txtDate = new wxTextCtrl(this, wxID_ANY, "", wxPoint(120, 130)); + + btnOk = new wxButton(this, 10004, "OK", wxPoint(80, 165)); + btnCancel = new wxButton(this, 10005, "Cancel", wxPoint(155, 165)); +} + +ReservationDialog::ReservationDialog(string name, string number, string size, string time, string date) : wxDialog(nullptr, wxID_ANY, "Reserve Table", wxPoint(100, 100), wxSize(260, 240)) +{ + lblName = new wxStaticText(this, wxID_ANY, "*Reservation Name:", wxPoint(10, 10)); + lblNumber = new wxStaticText(this, wxID_ANY, "*Phone Number:", wxPoint(10, 40)); + lblSize = new wxStaticText(this, wxID_ANY, "*Party Size:", wxPoint(10, 70)); + lblTime = new wxStaticText(this, wxID_ANY, "Reservation Time:", wxPoint(10, 100)); + lblDate = new wxStaticText(this, wxID_ANY, "Reservation Date:", wxPoint(10, 130)); + + txtName = new wxTextCtrl(this, wxID_ANY, name, wxPoint(120, 10)); + txtNumber = new wxTextCtrl(this, wxID_ANY, number, wxPoint(120, 40)); + txtSize = new wxTextCtrl(this, wxID_ANY, size, wxPoint(120, 70)); + txtTime = new wxTextCtrl(this, wxID_ANY, time, wxPoint(120, 100)); + txtDate = new wxTextCtrl(this, wxID_ANY, date, wxPoint(120, 130)); + + btnOk = new wxButton(this, 10004, "OK", wxPoint(80, 165)); + btnCancel = new wxButton(this, 10005, "Cancel", wxPoint(155, 165)); +} + +// get values from text boxes and close +void ReservationDialog::Ok(wxCommandEvent& evt) +{ + size = txtSize->GetValue().ToStdString(); + time = txtTime->GetValue().ToStdString(); + name = txtName->GetValue().ToStdString(); + number = txtNumber->GetValue().ToStdString(); + date = txtDate->GetValue().ToStdString(); + Close(); + evt.Skip(); +} + +// set values to default value and close +void ReservationDialog::Cancel(wxCommandEvent& evt) +{ + canceled = true; + Close(); + evt.Skip(); +} \ No newline at end of file diff --git a/1st-Semester-Fall-2021/CSNP/CSNP-04103-Final-Project/wxBase/wxBase/ReservationDialog.h b/1st-Semester-Fall-2021/CSNP/CSNP-04103-Final-Project/wxBase/wxBase/ReservationDialog.h new file mode 100644 index 0000000..42ad9f6 --- /dev/null +++ b/1st-Semester-Fall-2021/CSNP/CSNP-04103-Final-Project/wxBase/wxBase/ReservationDialog.h @@ -0,0 +1,35 @@ +#pragma once +#include +#include + +using namespace std; + +class ReservationDialog : public wxDialog +{ +public: + ReservationDialog(); + ReservationDialog(string, string, string, string, string); + + void Ok(wxCommandEvent&); + void Cancel(wxCommandEvent&); + + wxTextEntry* txtName = nullptr; + wxTextEntry* txtNumber = nullptr; + wxTextEntry* txtSize = nullptr; + wxTextEntry* txtTime = nullptr; + wxTextEntry* txtDate = nullptr; + + wxStaticText* lblName = nullptr; + wxStaticText* lblNumber = nullptr; + wxStaticText* lblSize = nullptr; + wxStaticText* lblTime = nullptr; + wxStaticText* lblDate = nullptr; + + wxButton* btnOk = nullptr; + wxButton* btnCancel = nullptr; + + string size, name, number, date, time; + bool canceled; + + wxDECLARE_EVENT_TABLE(); +}; \ No newline at end of file diff --git a/1st-Semester-Fall-2021/CSNP/CSNP-04103-Final-Project/wxBase/wxBase/Restaurant.cpp b/1st-Semester-Fall-2021/CSNP/CSNP-04103-Final-Project/wxBase/wxBase/Restaurant.cpp new file mode 100644 index 0000000..defab74 --- /dev/null +++ b/1st-Semester-Fall-2021/CSNP/CSNP-04103-Final-Project/wxBase/wxBase/Restaurant.cpp @@ -0,0 +1,178 @@ +#include "Restaurant.h" +#include +#include +#include + +using namespace std; + +Restaurant::Restaurant() +{ +} + +void Restaurant::addTable(int size) +{ + Table t; + t.size = size; + tables.push_back(t); +} + +bool Restaurant::reserveTable(int tNum) +{ + return reserveTable(tNum, time(0)); +} + +bool Restaurant::reserveTable(int tNum, int time) +{ + if (!isReserved(tNum, time)) + { + Reservation r; + r.time = time; + tables.at(tNum).reservations.push_back(r); + return true; + } + return false; +} + +void Restaurant::setFileName(string str) +{ + fileName = str; +} + +bool Restaurant::save() +{ + if (fileName != "") + { + ofstream r; + r.open(fileName + ".txt"); + r.clear(); + r << "tables: " + tables.size() << endl; + for (int i = 0; i < tables.size(); i++) + { + r << "table: " << i << endl + << "size: " << tables.at(i).size << endl + << "reservations: " << tables.at(i).reservations.size() << endl; + for (int j = 0; j < tables.at(i).reservations.size(); j++) + { + r << tables.at(i).reservations.at(j).lastName << endl + << tables.at(i).reservations.at(j).partySize << endl + << tables.at(i).reservations.at(j).phoneNumber << endl + << tables.at(i).reservations.at(j).time << endl; + } + } + r.close(); + return true; + } + return false; +} + +bool Restaurant::load(string fileName) +{ + if (fileName != "") + { + tables.clear(); + fstream r; + r.open(fileName + ".txt"); + string line; + int tableCount; + } + return false; +} + +// attempt to make a reservation for a party of at