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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!