added old projects

This commit is contained in:
Austin Bennett
2026-02-03 08:18:39 -06:00
parent 43acf989bf
commit 2451448b8a
623 changed files with 28117 additions and 0 deletions
View File
+8
View File
@@ -0,0 +1,8 @@
{
"files.associations": {
"iosfwd": "cpp",
"typeinfo": "cpp",
"vector": "cpp",
"string": "cpp"
}
}
+28
View File
@@ -0,0 +1,28 @@
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++ build active file",
"command": "/usr/bin/g++",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
Binary file not shown.
@@ -0,0 +1,8 @@
{
"files.associations": {
"iosfwd": "cpp",
"typeinfo": "cpp",
"vector": "cpp",
"string": "cpp"
}
}
+28
View File
@@ -0,0 +1,28 @@
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++ build active file",
"command": "/usr/bin/g++",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
+49
View File
@@ -0,0 +1,49 @@
/*
* Header file for ReadValue
*/
#include <iostream>
#include <climits>
#include <string>
template<typename inputType>
inputType ReadValue(std::string prompt)
{
inputType returnValue=0;
std::cout << prompt;
std::cin >> returnValue;
while (std::cin.fail()) {
std::cout << "Error! Cannot read input.\n";
std::cin.clear();
std::cin.ignore(INT_MAX,'\n');
std::cout << prompt;
std::cin >> returnValue;
}
return returnValue;
}
template<typename inputType>
inputType ReadValue(std::string prompt, inputType minValue)
{
inputType returnValue=0;
returnValue=ReadValue<inputType>(prompt);
while (returnValue < minValue) {
std::cout << "Error! Value must be >= " << minValue << std::endl;
returnValue=ReadValue<inputType>(prompt);
}
return returnValue;
}
template<typename inputType>
inputType ReadValue(std::string prompt, inputType minValue, inputType maxValue)
{
inputType returnValue=0;
returnValue=ReadValue<inputType>(prompt,minValue);
while (returnValue > maxValue) {
std::cout << "Error! Value must be <= " << maxValue << std::endl;
returnValue=ReadValue<inputType>(prompt,minValue);
}
return returnValue;
}
@@ -0,0 +1,40 @@
#include "person.cpp"
using namespace std;
class Laborer : public Person
{
protected:
string _job;
string _laborerEmployeeID;
string _hourlySalary;
string _hoursWorked;
public:
Laborer(string laborerName, string laborerBirthday, string laborerSSN, string job, string employeeID, string hourlySalary, string hoursWorked) : Person(laborerName, laborerBirthday, laborerSSN)
{
_job = job;
_laborerEmployeeID = employeeID;
_hourlySalary = hourlySalary;
_hoursWorked = hoursWorked;
}
// Accessors
string getJob() { return _job; };
string getEmployeeID() { return _laborerEmployeeID; };
string getHourlySalary() { return _hourlySalary; };
string getHoursWorked() { return _hoursWorked; };
string getType() { return "Laborer"; }
// Mutators
void setJob(string job) { _job = job; };
void setEmployeeID(string employeeID) { _laborerEmployeeID = employeeID; };
void setHourlySalary(string hourlySalary) { _hourlySalary = hourlySalary; };
void setHoursWorked(string hoursWorked) { _hoursWorked = hoursWorked; };
void Display() {
cout << endl;
cout << getType() << ":" << endl;
cout << " " << getName() << " " << getBirthday() << " " << getSSN() << " " << getJob() << " " << getEmployeeID() << " " << getHourlySalary() << " " << getHoursWorked() << endl;
}
};
+150
View File
@@ -0,0 +1,150 @@
//
// main.cpp
// Business
//
// Created by Austin Bennett on 7/7/22.
//
#include <iostream>
#include <vector>
#include "input.h"
#include "person.cpp"
#include "laborer.cpp"
#include "manager.cpp"
#include "owner.cpp"
using namespace std;
int main()
{
vector<Person *> list;
int choice;
do
{
cout << endl
<< " 1 - Add Laborer\n"
<< " 2 - Add Manager\n"
<< " 3 - Add Owner\n"
<< " 4 - Display List\n"
<< " 5 - Exit.\n"
<< " Enter your choice and press return: ";
cin >> choice;
cout << endl;
switch (choice)
{
case 1: // Add Laborer
{
cout << "Name: ";
string name;
cin.ignore();
getline(cin, name);
cout << "Birthday: ";
string birthday;
getline(cin, birthday);
cout << "SSN: ";
string ssn;
getline(cin, ssn);
cout << "Job: ";
string job;
getline(cin, job);
cout << "Employee ID: ";
string laborerEmployeeID;
getline(cin, laborerEmployeeID);
cout << "Hourly Salary: ";
string hourlySalary;
getline(cin, hourlySalary);
cout << "Hours Worked: ";
string hoursWorked;
getline(cin, hoursWorked);
list.push_back(new Laborer(name, birthday, ssn, job, laborerEmployeeID, hourlySalary, hoursWorked));
break;
}
case 2: // Add Manager
{
cout << "Name: ";
string name;
cin.ignore();
getline(cin, name);
cout << "Birthday: ";
string birthday;
getline(cin, birthday);
cout << "SSN: ";
string ssn;
getline(cin, ssn);
cout << "Department: ";
string department;
getline(cin, department);
cout << "Employee ID: ";
string managerEmployeeID;
getline(cin, managerEmployeeID);
cout << "Salary: ";
string salary;
getline(cin, salary);
list.push_back(new Manager(name, birthday, ssn, department, managerEmployeeID, salary));
break;
}
case 3: // Add Owner
{
cout << "Name: ";
string name;
cin.ignore();
getline(cin, name);
cout << "Birthday: ";
string birthday;
getline(cin, birthday);
cout << "SSN: ";
string ssn;
getline(cin, ssn);
cout << "Percent Owned: ";
string percentOwned;
getline(cin, percentOwned);
cout << "Owner Since: ";
string ownerSince;
getline(cin, ownerSince);
list.push_back(new Owner(name, birthday, ssn, percentOwned, ownerSince));
break;
}
case 4: // Display List
for (int i = 0; i < list.size(); i++)
{
list[i]->Display();
}
break;
case 5: // Exit
cout << "End of Program.\n";
break;
default:
cout << "Not a Valid Choice. \n"
<< "Choose again.\n";
break;
}
} while (choice != 5);
return 0;
}
@@ -0,0 +1,36 @@
#include "person.cpp"
using namespace std;
class Manager : public Person
{
protected:
string _department;
string _managerEmployeeID;
string _salary;
public:
Manager(string managerName, string managerBirthday, string managerSSN, string department, string employeeID, string salary) : Person(managerName, managerBirthday, managerSSN)
{
_department = department;
_managerEmployeeID = employeeID;
_salary = salary;
}
// Accessors
string getDepartment() { return _department; };
string getEmployeeID() { return _managerEmployeeID; };
string getSalary() { return _salary; };
string getType() { return "Manager"; };
// Mutators
void setDepartment(string department) { _department = department; };
void setEmployeeID(string employeeID) { _managerEmployeeID = employeeID; };
void setSalary(string salary) { _salary = salary; };
void Display() {
cout << endl;
cout << getType() << ":" << endl;
cout << " " << getName() << " " << getBirthday() << " " << getSSN() << " " << getDepartment() << " " << getEmployeeID() << " " << getSalary() << endl;
}
};
@@ -0,0 +1,32 @@
#include "person.cpp"
using namespace std;
class Owner : public Person
{
protected:
string _percentOwned;
string _ownerSince;
public:
Owner(string ownerName, string ownerBirthday, string ownerSSN, string percentOwned, string ownerSince) : Person(ownerName, ownerBirthday, ownerSSN)
{
_percentOwned = percentOwned;
_ownerSince = ownerSince;
}
// Accessors
string getPercentOwned() { return _percentOwned; };
string getOwnerSince() { return _ownerSince; };
string getType() { return "Owner"; };
// Mutators
void setPercentOwned(string percentOwned) { _percentOwned = percentOwned; };
void setOwnerSince(string ownerSince) { _ownerSince = ownerSince; };
void Display() {
cout << endl;
cout << getType() << ":" << endl;
cout << " " << getName() << " " << getBirthday() << " " << getSSN() << " " << getPercentOwned() << " " << getOwnerSince()<< endl;
}
};
@@ -0,0 +1,35 @@
#include <string>
#include <iostream>
#pragma once
using namespace std;
class Person
{
protected:
string _name;
string _birthday;
string _ssn;
public:
Person(string name, string birthday, string ssn)
{
_name = name;
_birthday = birthday;
_ssn = ssn;
}
// Accessors
string getName() { return _name; };
string getBirthday() { return _birthday; };
string getSSN() { return _ssn; };
string getType() { return "Person"; };
// Mutators
void setName(string name) { _name = name; }
void setBirthday(string birthday) { _birthday = birthday; };
void setSSN(string ssn) { _ssn = ssn; };
virtual void Display() = 0;
};
Binary file not shown.
+49
View File
@@ -0,0 +1,49 @@
/*
* Header file for ReadValue
*/
#include <iostream>
#include <climits>
#include <string>
template<typename inputType>
inputType ReadValue(std::string prompt)
{
inputType returnValue=0;
std::cout << prompt;
std::cin >> returnValue;
while (std::cin.fail()) {
std::cout << "Error! Cannot read input.\n";
std::cin.clear();
std::cin.ignore(INT_MAX,'\n');
std::cout << prompt;
std::cin >> returnValue;
}
return returnValue;
}
template<typename inputType>
inputType ReadValue(std::string prompt, inputType minValue)
{
inputType returnValue=0;
returnValue=ReadValue<inputType>(prompt);
while (returnValue < minValue) {
std::cout << "Error! Value must be >= " << minValue << std::endl;
returnValue=ReadValue<inputType>(prompt);
}
return returnValue;
}
template<typename inputType>
inputType ReadValue(std::string prompt, inputType minValue, inputType maxValue)
{
inputType returnValue=0;
returnValue=ReadValue<inputType>(prompt,minValue);
while (returnValue > maxValue) {
std::cout << "Error! Value must be <= " << maxValue << std::endl;
returnValue=ReadValue<inputType>(prompt,minValue);
}
return returnValue;
}
+40
View File
@@ -0,0 +1,40 @@
#include "person.cpp"
using namespace std;
class Laborer : public Person
{
protected:
string _job;
string _laborerEmployeeID;
string _hourlySalary;
string _hoursWorked;
public:
Laborer(string laborerName, string laborerBirthday, string laborerSSN, string job, string employeeID, string hourlySalary, string hoursWorked) : Person(laborerName, laborerBirthday, laborerSSN)
{
_job = job;
_laborerEmployeeID = employeeID;
_hourlySalary = hourlySalary;
_hoursWorked = hoursWorked;
}
// Accessors
string getJob() { return _job; };
string getEmployeeID() { return _laborerEmployeeID; };
string getHourlySalary() { return _hourlySalary; };
string getHoursWorked() { return _hoursWorked; };
string getType() { return "Laborer"; }
// Mutators
void setJob(string job) { _job = job; };
void setEmployeeID(string employeeID) { _laborerEmployeeID = employeeID; };
void setHourlySalary(string hourlySalary) { _hourlySalary = hourlySalary; };
void setHoursWorked(string hoursWorked) { _hoursWorked = hoursWorked; };
void Display() {
cout << endl;
cout << getType() << ":" << endl;
cout << " " << getName() << " " << getBirthday() << " " << getSSN() << " " << getJob() << " " << getEmployeeID() << " " << getHourlySalary() << " " << getHoursWorked() << endl;
}
};
+233
View File
@@ -0,0 +1,233 @@
//
// main.cpp
// Business
//
// Created by Austin Bennett on 7/7/22.
//
#include <iostream>
#include <vector>
#include "person.cpp"
#include "laborer.cpp"
#include "manager.cpp"
#include "owner.cpp"
using namespace std;
vector<Person *> list;
void DisplayAddMenu()
{
int choice;
do
{
cout << endl
<< " 1 - Add Laborer\n"
<< " 2 - Add Manager\n"
<< " 3 - Add Owner\n"
<< " 4 - Exit.\n"
<< " Enter your choice and press return: ";
cin >> choice;
cout << endl;
if (choice == 1)
{
cout << "Name: ";
string name;
cin.ignore();
getline(cin, name);
cout << "Birthday: ";
string birthday;
getline(cin, birthday);
cout << "SSN: ";
string ssn;
getline(cin, ssn);
cout << "Job: ";
string job;
getline(cin, job);
cout << "Employee ID: ";
string laborerEmployeeID;
getline(cin, laborerEmployeeID);
cout << "Hourly Salary: ";
string hourlySalary;
getline(cin, hourlySalary);
cout << "Hours Worked: ";
string hoursWorked;
getline(cin, hoursWorked);
list.push_back(new Laborer(name, birthday, ssn, job, laborerEmployeeID, hourlySalary, hoursWorked));
}
else if (choice == 2)
{
cout << "Name: ";
string name;
cin.ignore();
getline(cin, name);
cout << "Birthday: ";
string birthday;
getline(cin, birthday);
cout << "SSN: ";
string ssn;
getline(cin, ssn);
cout << "Department: ";
string department;
getline(cin, department);
cout << "Employee ID: ";
string managerEmployeeID;
getline(cin, managerEmployeeID);
cout << "Salary: ";
string salary;
getline(cin, salary);
list.push_back(new Manager(name, birthday, ssn, department, managerEmployeeID, salary));
}
else if (choice == 3)
{
cout << "Name: ";
string name;
cin.ignore();
getline(cin, name);
cout << "Birthday: ";
string birthday;
getline(cin, birthday);
cout << "SSN: ";
string ssn;
getline(cin, ssn);
cout << "Percent Owned: ";
string percentOwned;
getline(cin, percentOwned);
cout << "Owner Since: ";
string ownerSince;
getline(cin, ownerSince);
list.push_back(new Owner(name, birthday, ssn, percentOwned, ownerSince));
}
else if (choice == 4)
{
break;
}
else
{
cout << "Invalid Input\n";
cin.clear();
cin.ignore(10000, '\n');
}
} while (choice != 4);
}
void DisplayListMenu()
{
int choice;
do
{
cout << endl
<< " 1 - View Laborers\n"
<< " 2 - View Managers\n"
<< " 3 - View Owners\n"
<< " 4 - Exit.\n"
<< " Enter your choice and press return: ";
cin >> choice;
cout << endl;
if (choice == 1)
{
for (int i = 0; i < list.size(); i++)
{
Person* person = list[i];
cout << person -> getType();;
string type = list[i]->getType();
if (type == "Laborer")
{
list[i]->Display();
}
}
}
else if (choice == 2)
{
for (int i = 0; i < list.size(); i++)
{
Person *person = list[i];
string type = person->getType();
if (type == "Manager")
{
list[i]->Display();
}
}
}
if (choice == 3)
{
for (int i = 0; i < list.size(); i++)
{
string type = list[i]->getType();
if (type == "Owner")
{
list[i]->Display();
}
}
}
else if (choice == 4)
{
break;
}
else
{
cin.clear();
cin.ignore(10000, '\n');
}
} while (choice != 4);
}
int main()
{
int choice;
do
{
cout << endl
<< " 1 - Add Person\n"
<< " 2 - Display List\n"
<< " 3 - Exit.\n"
<< " Enter your choice and press return: ";
cin >> choice;
cout << endl;
if (choice == 1)
{
DisplayAddMenu();
}
else if (choice == 2)
{
DisplayListMenu();
}
else if (choice == 3)
{
cout << "End of Program.\n";
cin.clear();
cin.ignore(10000, '\n');
}
else
{
cout << "Not a Valid Choice. \nChoose again.\n";
}
} while (choice != 3);
return 0;
}
+36
View File
@@ -0,0 +1,36 @@
#include "person.cpp"
using namespace std;
class Manager : public Person
{
protected:
string _department;
string _managerEmployeeID;
string _salary;
public:
Manager(string managerName, string managerBirthday, string managerSSN, string department, string employeeID, string salary) : Person(managerName, managerBirthday, managerSSN)
{
_department = department;
_managerEmployeeID = employeeID;
_salary = salary;
}
// Accessors
string getDepartment() { return _department; };
string getEmployeeID() { return _managerEmployeeID; };
string getSalary() { return _salary; };
string getType() { return "Manager"; };
// Mutators
void setDepartment(string department) { _department = department; };
void setEmployeeID(string employeeID) { _managerEmployeeID = employeeID; };
void setSalary(string salary) { _salary = salary; };
void Display() {
cout << endl;
cout << getType() << ":" << endl;
cout << " " << getName() << " " << getBirthday() << " " << getSSN() << " " << getDepartment() << " " << getEmployeeID() << " " << getSalary() << endl;
}
};
+32
View File
@@ -0,0 +1,32 @@
#include "person.cpp"
using namespace std;
class Owner : public Person
{
protected:
string _percentOwned;
string _ownerSince;
public:
Owner(string ownerName, string ownerBirthday, string ownerSSN, string percentOwned, string ownerSince) : Person(ownerName, ownerBirthday, ownerSSN)
{
_percentOwned = percentOwned;
_ownerSince = ownerSince;
}
// Accessors
string getPercentOwned() { return _percentOwned; };
string getOwnerSince() { return _ownerSince; };
string getType() { return "Owner"; };
// Mutators
void setPercentOwned(string percentOwned) { _percentOwned = percentOwned; };
void setOwnerSince(string ownerSince) { _ownerSince = ownerSince; };
void Display() {
cout << endl;
cout << getType() << ":" << endl;
cout << " " << getName() << " " << getBirthday() << " " << getSSN() << " " << getPercentOwned() << " " << getOwnerSince()<< endl;
}
};
+36
View File
@@ -0,0 +1,36 @@
#include <string>
#include <iostream>
#pragma once
using namespace std;
class Person
{
protected:
string _name;
string _birthday;
string _ssn;
public:
Person(string name, string birthday, string ssn)
{
_name = name;
_birthday = birthday;
_ssn = ssn;
}
// Accessors
string getName() { return _name; };
string getBirthday() { return _birthday; };
string getSSN() { return _ssn; };
// Mutators
void setName(string name) { _name = name; }
void setBirthday(string birthday) { _birthday = birthday; };
void setSSN(string ssn) { _ssn = ssn; };
virtual void Display() = 0;
virtual string getType();
};