Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Task: You will design and implement a class that contains a container of employees. You will implement a sequence class to use as the container.

Task:

You will design and implement a class that contains a container of employees. You will implement a sequence class to use as the container. The sequence class is simply a bag class but with the additional requirement that items inserted maintain a certain ordering.

Items in a sequence are kept one after another, and member functions will allow a program to step through the sequence one item at a time. Member functions will also allow the program to control precisely where items are inserted and removed within the sequence.

Details:

  1. Implement the sequence class. You will need to provide the following member functions:

    • A function to add a new item at the front of the sequence

    • A function to remove the item from the front of the sequence

    • A function to add a new item at the end of the sequence

    • A function that makes the last item of the sequence become the current item

    • Operators for + and += (Note: for the + operator, x+y contains all the items of x, followed by all the items of y. The statement x += y appends all of the items of y to the end of what is already in x.

    • Overload the subscript operator (square brackets []), so that we can refer to the individual items using the usual C++ notation for arrays.

value_type operator[](size_type index) const;

  1. Implement a class called employee. It should have the following members:

    • Data members for employees name, ID number, hours worked, and salary based on the hourly wage

    • An additional data member for storing biweekly paycheck information

    • A member function for calculating overtime(for over 40 hours per week) for each paycheck (overtime should be time and a half only for hours worked over 40)

    • Member function for computing the yearly salary

    • Member function for increasing the salary by a certain percentage

    • Mutator functions for employee info

    • Accessor functions for employee info

  2. Implement a class(Personnel) that contains a sequence of employees. You will have to modify the employee class to include equality and comparison operators. This class should provide functions that calculate statistics on the employees, such as average age, average salary, number of hours worked, number of overtime hours, ratio of male/females. You may have to modify the employee class to store any necessary information.

Your main should consist of an interactive test program. The program should give the user a menu of choices to add, remove, or modify an employee, and to print any available statistics. You should provide a file with user input to copy and paste into your program. sequence.h #ifndef SEQUENCE_H #define SEQUENCE_H #include // Provides size_t

class sequence { public: // TYPEDEFS and MEMBER CONSTANTS

typedef double value_type; typedef std::size_t size_type;

static const size_type CAPACITY = 30; // CONSTRUCTOR sequence( ); // MODIFICATION MEMBER FUNCTIONS void start( ); void advance( ); void insert(const value_type& entry); void attach(const value_type& entry); void remove_current( );

// CONSTANT MEMBER FUNCTIONS size_type size( ) const; bool is_item( ) const; value_type current( ) const;

private: value_type data[CAPACITY]; size_type used; size_type current_index; }; #endif it should contain the following files

  • sequence.h is provided above

  • sequence.cpp

  • employee.h

  • employee.cpp

  • personnel.cpp

  • personnel.h

  • main.cpp

  • input.txt

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Database Programming With Visual C# .NET

Authors: Ying Bai

1st Edition

0470467274, 978-0470467275

More Books

Students also viewed these Databases questions

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago