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
Binary file not shown.
+28
View File
@@ -0,0 +1,28 @@
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: clang++ build active file",
"command": "/usr/bin/clang++",
"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"
}
@@ -0,0 +1,28 @@
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: clang++ build active file",
"command": "/usr/bin/clang++",
"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"
}
@@ -0,0 +1,42 @@
#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"; }
virtual string getName() { return _name; };
// 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;
}
};
@@ -0,0 +1,251 @@
//
// 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 - Return to Main Menu\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 - Return to Main Menu\n"
<< " Enter your choice and press return: ";
cin >> choice;
cout << endl;
if (choice == 1)
{
for (int i = 0; i < list.size(); i++)
{
string type = list[i]->getType();
if (type == "Laborer")
{
list[i]->Display();
}
}
}
else if (choice == 2)
{
for (int i = 0; i < list.size(); i++)
{
string type = list[i]->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 - Sort List\n"
<< " 4 - 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)
{
int i, j, n;
n = list.size();
for (i = 0; i < n - 1; i++)
{
for (j = 0; j < n - i - 1; j++)
{
if (list[j]->getName() > list[j + 1]->getName())
{
swap(list[j], list[j + 1]);
}
}
}
for (int i = 0; i < n; i++)
{
list[i]->Display();
}
}
else if (choice == 4)
{
cout << "End of Program.\n";
cin.clear();
cin.ignore(10000, '\n');
}
else
{
cout << "Not a Valid Choice. \nChoose again.\n";
}
} while (choice != 4);
return 0;
}
@@ -0,0 +1,38 @@
#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"; };
virtual string getName() { return _name; };
// 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,34 @@
#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"; };
virtual string getName() { return _name; };
// 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,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 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() = 0;
virtual string getName() = 0;
};
+251
View File
@@ -0,0 +1,251 @@
//
// 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 - Return to Main Menu\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 - Return to Main Menu\n"
<< " Enter your choice and press return: ";
cin >> choice;
cout << endl;
if (choice == 1)
{
for (int i = 0; i < list.size(); i++)
{
string type = list[i]->getType();
if (type == "Laborer")
{
list[i]->Display();
}
}
}
else if (choice == 2)
{
for (int i = 0; i < list.size(); i++)
{
string type = list[i]->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 - Sort List\n"
<< " 4 - 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)
{
int i, j, n;
n = list.size();
for (i = 0; i < n - 1; i++)
{
for (j = 0; j < n - i - 1; j++)
{
if (list[j]->getName() > list[j + 1]->getName())
{
swap(list[j], list[j + 1]);
}
}
}
for (int i = 0; i < n; i++)
{
list[i]->Display();
}
}
else if (choice == 4)
{
cout << "End of Program.\n";
cin.clear();
cin.ignore(10000, '\n');
}
else
{
cout << "Not a Valid Choice. \nChoose again.\n";
}
} while (choice != 4);
return 0;
}