Project-2 Objective The purpose of this project is to expose you to Classes, objects, data members, member functions, and header files. . Problem Specification Design a class that will do the following • Accept a department’s name in the school (a string) and maintains two arrays of employee’s data, one for the employee’s

Project-2
 
 
Objective:
The purpose of this project is to expose you to:
Classes, objects, data members, member functions, and header files.
.
Problem Specification:
Design a class that will do the following:

  • Accept a department’s name in the school (a string) and maintains two arrays of employee’s data, one for the employee’s id, a string, the other for the employee’s salary, which might be integer, float or double.

 

  • If there is room, you can add an id and a salary at the first available position. That is the position immediately following the last added employee. However; if the arrays are empty, you add at the first position. If the array is full, then you cannot add and must indicate that. The function add is a Boolean function that returns true when an item is added, otherwise it returns false.
  • If there are employees, you can remove the employee’s data for a given Id number; you need to write a (private) search function that returns the index of the id, the arrays are then compressed. If the array is empty, then you cannot remove and must indicate that. The function remove is a Boolean function that returns true when an item is removed, otherwise it returns false.

 

  • You can also clear the arrays of all the data, but before you do that, you must call the private function print, which will print the employee’s data in reverse order, that is, the last employee’s data in the array will be printed first.

 
Requirements:

  • Create a CRC card as explained in chapter 1.
  • Specify each method’s purpose, describe its parameters, and write a pseudo-code version of its header as explained in chapter 1.
  • Create a class diagram showing the class name, public and private members.
  • You are to create a header file that contains the class declaration and interface file (implementation) for the class that will maintain objects of the class.
  • You are to create a constructor that may take the department name as an argument, and if it’s null it will ask for a department name to be entered from the keyboard and stores it. It also initializes a counter that keeps track of the number of employees in the array and is maintained when you add, remove, or clear.
  • You have to define a null destructor.
  • The maximum number of employees is 5 and is stored in the class data as a static constant.
  • The id number is a string; the salary may be integers, floats or doubles.
  • Two private methods must be defined to determine if the array isFull or

 
The file “proj3.cpp” is the client file that tests the methods defined in the implementation file and declared in the header file called “proj3.h”
 
Grading Criteria:
5 points         Good programming practices: Proper spacing, comments, use of variables, indentations and appearance of program.
5 points         default constructor is defined and performs its task.
5 points         destructor is defined and is null.
5 points         CRC card is submitted correct and complete.
5 points         a UML class diagram is submitted and is correct.
5 points        a header file is used to define the class.
5 points        a C++ implementation file contains member functions definitions.
10 points        class templates are used to accommodate different types.
5 points        the preprocessor directive #ifndef is properly used.
10 points        methods specifications and pseudopod.
5 points        modules coupling and cohesiveness.
5 points        Accessor methods are constants and parameters passed are also constants.
5 points        the clear method calls the print function, which prints the array elements, last to first before clearing the array.
20 points         Program solution fits specifications.
5 points         test results to demonstrate a run.
 
Submission Details: Hand-in

  • The CRC card
  • Methods specifications
  • Class diagram
  • Source program files
  • Test results.

 
***** Due Date 04-03-2019 *****
 
 

Posted in Uncategorized