You must submit your program electronically via gsubmit on csa.
Late programs will be accepted, but only if you use one of your two free 48-hour extensions (strongly discouraged at this point in the course).
The code you submit must conform with the programming guidelines.
Please be sure that you have subscribed to the CS 112 mailing list (by typing "csmail -a cs112b1" at the csa.bu.edu prompt) to receive updates, corrections and clarifications to this and other assignments.
In the file called payroll.cpp, implement the classes Employee and Payroll (defined in the provided header file, payroll.h). An Employee is a class with just three public data members.
class Employee
{
public:
string name;
int ID;
double salary;
};
You can implement constructor, read and print functions for Employee in payroll.cpp if you wish.
A Payroll is defined as follows.
class Payroll
{
public:
Payroll();
unsigned int size();
void print(ostream &os) const;
void add(const Employee& newbie);
void remove(int i);
int position(string &target_name) const;
void operator =(const Payroll& source);
void operator +=(const Payroll& source);
private:
Employee *people;
unsigned int maximum_size;
unsigned int current_size;
void double_maximum_size();
};
The Payroll class consists of a set of Employees, pointed to by the people variable. The constructor will allocate an array of some positive size to people. This size is remembered in the private member variable maximum_size. Later, a private member function can double the size of the payroll as needed. (We will not worry about decreasing the size of the payroll.) Only the initial part of the array will store actual Employees: you should store the number of actual Employees in the private variable current_size.
You get to implement the following member functions:
In the file called test_payroll.cpp write a program that tests all public member functions of your Payroll class.
We recommend that you use our Makefile to compile your code.
Be sure to remove all debugging statements before submission.
Then gsubmit only the following four files into the 01 directory: payroll.h, payroll.cpp, test_payroll.cpp, Makefile.
You are responsible for thoroughly testing your program to make sure that it works. Your code must run correctly on csa. In grading your program, we will verify that your test cases adequately test your routines, then test your program on some payroll test files of our own.