[Solved] CSE240 Homework9-Create Nontechnical and Technical child classes of Employee class

$25

File Name: CSE240_Homework9-Create_Nontechnical_and_Technical_child_classes_of_Employee_class.zip
File Size: 772.44 KB

SKU: [Solved] CSE240 Homework9-Create Nontechnical and Technical child classes of Employee class Category: Tag:
5/5 - (1 vote)

You are given a partially completed project containing:

  • header files:h employee.h nontechnical.h technical.h
  • C++ files:

Container.cpp employee.cpp nontechnical.cpp technical.cpp hw9.cpp

The diagram shows the inheritance and relationships between the classes and the linked list formed.

Employee class is defined in employee.h and member functions are defined in employee.cpp.

Q1: Create Nontechnical and Technical child classes of Employee class (Inheritance) (10 points)

Files: nontechnical.h , technical.h

Q2: Define displayEmployee() for child classes (Polymorphism) (10 points)

Files: nontechnical.cpp , technical.cpp

Q3: Add Friend function changeSalary() (5 points)

Q3.a in employee.h

Q3.b in hw9.cpp

Q3.c in hw9.cpp. Case c of executeAction( )

Q4 Q7 are used to implement a menu-driven program. Its implementation is in hw9.cpp. The menu gives the following options to user:

  1. Add a new employee to the list. You do not need to check if the employee exists in the list because that is already implemented in executeAction(). You may add the new employee to head or tail of the list. (sample solution adds it to the tail)
  2. Display the list of employees along with their details (name, salary, type).
  3. Change the salary of an employee. This option uses the friend function to access private data member salary of the employee and change it to the one entered by the user.

You need to implement save() that writes the list of books to a file list.txt while exiting the program and load() that reads the file to form the list at the beginning of the program. During first execution of the program, there will be no list.txt, so load() would not form a list. Once list.txt is saved, load() can read it the next time you run the program. You may remove the list.txt from your project directory if you do not want to load that list (maybe while testing your code).

The following is one way to store the list in list.txt file. The format here is:

<no. of employees>

<Employee1 name>

<Employee1 salary >

<Employee1 type>

<Employee2 name>

<Employee2 salary > <Employee2 type> and so on..

You may store it in another format if you wish. Notice that the 3 at the beginning is the number of employees stored in the file.

Expected output: addEmployee():

displayList():

changeSalary():

Verify by using option d.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CSE240 Homework9-Create Nontechnical and Technical child classes of Employee class
$25