Question
c++ code Create a code that will give the user the option to do any of the following: Add a Employee Fire a Employee Grade
c++ code
Create a code that will give the user the option to do any of the following:
Add a Employee Fire a Employee Grade a Employee View all Employes who still work for the company and also employees who have left. View all current Employees View all fired Employees
*use string_views when you are able 2*
( - Employees is graded between 0 or 5.)
You will need an implementation of the Dbase class, shown below.
Dbase.cpp code//////
using namespace std;
namespace Work{
Student& DBase::addStudent(const string& firstName,
const string& lastName)
{
Student theStudent{ firstName, lastName };
theStudent.setStudentNumber(m_nextStudentNumber++);
theStudent.Enroll();
m_Students.push_back(theStudent);
return m_Students.back();
}
Student& DBase::getStudent(int StudentNumber)
{
for (auto& Student : m_Students) {
if (Student.getStudentNumber() == StudentNumber) {
return Student;
}
}
throw logic_error{ "No Student found." };
}
Student& DBase::getStudent(const string& firstName, const string& lastName)
{
for (auto& Student : m_Students) {
if (Student.getFirstName() == firstName &&
Student.getLastName() == lastName) {
return Student;
}
}
throw logic_error{ "No Student found." };
}
void DBase::displayAll() const
{
for (const auto& Student : m_Students) {
Student.display();
}
}
void DBase::displayCurrent() const
{
for (const auto& Student : m_Students) {
if (Student.isEnrolled()) {
Student.display();
}
}
}
void DBase::displayFormer() const
{
for (const auto& Student : m_Students) {
if (!Student.isEnrolled()) {
Student.display();
}
}
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started