Question

C++ Simple Employee Tracking System


This assignment involves creating a program to track employee information.  Keep the following information on an employee:

1.     Employee ID (string, digits only, 6 characters)

2.     Last name (string)

3.     First Name (string)

4.     Birth date (string as MM/DD/YYYY)

5.     Gender (M or F, single character)

6.     Start date (string as MM/DD/YYYY)

7.     Salary per year (double)

Thus you must create a class that has all of this, and get/set methods for each of these fields.  Note: The fields that are designated as string should use the string class, not a char array.

Your class must have two constructors:

1.     No arguments.  Just construct an object, setting fields to empty (strings) or 0 (numbers).  This one is not used, but write it anyway.

2.     Takes all information.

When the program starts it must check to see if a file called Employee.txt exists.  If not, create it as an empty file.  If it does, read the information into Employee objects which you dynamically allocate and put them into an array of pointers to objects.  Data in the file is stored separated by spaces, one employee per line. Assume the company will have no more than 100 employees, but if it does, show an error.  You may not use vectors.

The program will have a menu that shows the following options:

1.     Enter new employee information.  When the ID is entered, make sure that ID is not in use for another employee.  Request the rest of the info and create a new Employee object.  While some input validation would be good, the only requirement is that the data not be null and that the salary must be a valid floating-point number greater than zero.  (Doing proper input validation is beyond the scope of this exercise and could easily double the size of the program.  Dates, in particular, are difficult to validate.)

2.     Display all employee information in alphabetical order by last name.  The list may not have been entered in order, but you must sort it to display it.  Show all of the information in fixed-field columns so that it looks neat.  (You can use printf for this if you like.)  Show the salary to the nearest dollar, right-justified.  The last column must be the monthly pay, a derived attribute.

3.     Look up an employee by ID.  If the ID exists, show all of the information, neatly formatted as in step 2.  If not, display a message.

4.     Remove an employee.  Ask for an employee ID, and if the ID exists, delete.  If not, display a message that there is no such employee.  This should delete the object pointer from your array and remove the Employee object from memory.  (How do you handle this in the array?)

5.     Save all data to Employee.txt and exit.  If the file exists, overwrite it. If it does not exist, create it.

Invalid menu options will display a message and return to show the menu.  After executing options 1 through 4, return to the menu.  Option 5 saves and exits.

The Employee class will not have a method to write all of the employees to the file, since it does not know about more than one employee at a time. However, you will have a method somewhere in your program to write them all out, with each piece of data separated by a blank, with one employee per line.  The best place to put this is in a separate class that has two methods: read all employees and write all employees.  This is consistent with three-layer architecture and good design principles.

To hand in:  Five files, called Employee.h, Employee.cpp, FileIO.h, FileIO.cpp, and <netID>Asg5.cpp.  Place these into a Zip file called <netID>Asg5.zip and hand that in.

Grading

Program initializes properly, reading information if it is there

10

Each menu item 1 through 5 works correctly. 15 points each

75

Employee class contains all and only the necessary functions and follows conventions for how classes work

5

Program comments and good variable names

10

 

Additional grading guidelines:

1.     Method in Employee class that does I/O, including display: -5

2.     Function in your main program that does file I/O. -10

3.     Not using pointers to objects. -10

4.     Use of Vectors: -10

5.     Not closing files that have been opened: -5

6.     Not freeing allocated memory when deleting an employee: -5


0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
C++ Simple Employee Tracking System
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • In header file (.h) and c++ file format (.cpp). A local company has asked you to...

    In header file (.h) and c++ file format (.cpp). A local company has asked you to write a program which creates an Employee class, a vector of Employee class objects, and fills the objects with employee data, creating a "database" of employee information. The program allows the user to repeatedly search for an employee in the vector by entering the employee's ID number and if found, display the employee's data. The Employee_C class should have the following data and in...

  • Create a C# Console program. Add a class named Employee that has the following public fields:...

    Create a C# Console program. Add a class named Employee that has the following public fields: • Name. The name field references a String object that holds the employee’s name. • IDNumber. The IDNumber is an int that holds the employee’s ID number. • Department. The department field is a String that holds the name of the department where the employee works. • Position. The position field is a String that holds the employee’s job title. Once you have written...

  • c++ only Design a class representing an Employee. The employee would have at least these private...

    c++ only Design a class representing an Employee. The employee would have at least these private fields (Variables): name: string (char array) ID: string (char array) salary: float Type: string (char array) All the variables except for the salary should have their respective setters and getters, and the class should have two constructors, one is the default constructor and the other constructor initializes the name,ID and type of employee with valid user input. The class should have the following additional...

  • In Java: Executable Class create an array of Employee objects. You can copy the array you...

    In Java: Executable Class create an array of Employee objects. You can copy the array you made for Chapter 20. create an ArrayList of Employee objects from that array. use an enhanced for loop to print all employees as shown in the sample output. create a TreeMap that uses Strings for keys and Employees as values. this TreeMap should map Employee ID numbers to their associated Employees. process the ArrayList to add elements to this map. print all employees in...

  • It must be C++ Chapter 13 Programming Challenge 2: Employee Class. See instruction: Chapter 13 Programming...

    It must be C++ Chapter 13 Programming Challenge 2: Employee Class. See instruction: Chapter 13 Programming Challenge 2 Employee Class.pdf Program Template: // Chapter 13, Programming Challenge 2: Employee Class #include <iostream> #include <string> using namespace std; // Employee Class Declaration class Employee { private: string name; // Employee's name int idNumber; // ID number string department; // Department name string position; // Employee's position public: // TODO: Constructors // TODO: Accessors // TODO: Mutators }; // Constructor #1 Employee::Employee(string...

  • public class EmployeeDriver public static void main(String[] args) 1/declare create an Employee object named joo. Une...

    public class EmployeeDriver public static void main(String[] args) 1/declare create an Employee object named joo. Une no-arg constructor 1/change the attributes for joe as the following: //name to Joe Cool, id to 1111111, hours to 20, pay rate to 15 //dealare & create another Employee oblegt named one using arg-constructor // The name of the new employees Jane Doeid is 2001122. She makes $10.50/hour // change the object Jane's hours to 40. 1/change the object jane's pay rate to $12.00....

  • PROGRAMMING LANGUAGE OOP'S WITH C++ Functional Requirements: A jewelry designer friend of mine requires a program...

    PROGRAMMING LANGUAGE OOP'S WITH C++ Functional Requirements: A jewelry designer friend of mine requires a program to hold information about the gemstones he has in his safe. Offer the jewelry designer the following menu that loops until he chooses option 4. 1. Input a gemstone 2. Search for a gemstone by ID number 3. Display all gemstone information with total value 4. Exit ------------------------------------- Gemstone data: ID number (int > 0, must be unique) Gem Name (string, length < 15)...

  • Write a C++ program Write a class named Employee that has the following member variables: name...

    Write a C++ program Write a class named Employee that has the following member variables: name A string that holds the employee name idNumber An int to hold employee id number department A string to hold the name of the department position A string to hold the job position The class will have three constructors: 1. A constructor that accepts all the internal data such as: Employee susan("Susan Meyers", 47899, "Accounting", "Vice President"); 2. A constructor that accepts some of...

  • Create the Python code for a program adhering to the following specifications. Write an Employee class...

    Create the Python code for a program adhering to the following specifications. Write an Employee class that keeps data attributes for the following pieces of information: - Employee Name (a string) - Employee Number (a string) Make sure to create all the accessor, mutator, and __str__ methods for the object. Next, write a class named ProductionWorker that is a subclass of the Employee class. The ProductionWorker class should keep data attributes for the following information: - Shift number (an integer,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
Active Questions
ADVERTISEMENT