HW4 (Project). Aperture Science Labs: Human Resources Management

HW4 (Project). Aperture Science Labs: Human Resources Management.

Due Saturday, May 16 (or 23?), by 11:59pm (Midnight).

There is only one task and only one program to be submitted.

The program should start with a comment that contains your name and a short program description, for example:

/*
  Author: Your Name 
  Description: HW 4. Project. Aperture Science HR.
  .. you may add a more detailed description if it's necessary ..
*/

If a program does not do what it’s supposed to do (e.g. there are some bugs, it behaves differently, or maybe even does not compile), then its “incomplete” status must be clearly mentioned in the comment to the program. In this case, please briefly describe what is implemented, and what is not.

Introduction

In accordance with the company anti-smoking policy, the Human Resources department of Aperture Science Laboratories wants to implement a new secret surveillance system for monitoring their personnel. This is probably an illegal thing to do, but the company lawyers believe that this is fine, and who are you to argue with that?

New smoke detectors and employee tracking devices have been setup and they already accumulate valuable data. However, there is no software to process these data yet. Congratulations, this is your job to write it, isn’t it exciting?!

Program Specification

The new software should be run from the terminal with 3 command line arguments:

  ./program employees.dat tracking.dat smoke.dat

If the number of command line arguments is less than 3, the program should exit immediately with an error message.

All arguments are file names. If the program cannot open these files, it should exit with an error message.

File formats

Employees data

# Number of employees
5
# EmployeeID FirstName LastName OfficeLocation
  11         John      Johnson  513
  37         Michael   Burke    11
  24         Mary      Clark    8 
  183        Vincent   Cent     11 
  19         Roseline  Harp     5

The OfficeLocation field is the place where the employee works, and it’s expected that the employee spends at least 75% of their time at this place.

Tracking data

All information from the employee tracking devices is listed here

# Number of entries
53
# Timestamp EmployeeID Location
  105       11         61
  105       24         6
  105       37         17
  105       19         8
  106       37         17
  106       24         5
  106       19         8
  106       11         62
  106       183        20
  107       37         17
  ...

(In this file, there is supposed to be exactly one record per timestamp for every employee, however, observe that due to infrequent tracking device failures, the locations of some employees are not reported at some timestamps, assume that their location is unknown at those time intervals)

Smoke detectors data

This datafile lists all locations where smoke was detected

# Number of entries
7
# Timestamp Location
  106       62
  107       213
  110       11
  112       11
  ...

The EmployeeID and Location values are positive integers, but they can be large.

Converting a string to int

The easiest way to convert a string to int is to use the function stoi(s), however it’s a part of the C++11 language standard, and to compile such code with g++, you have to run the compiler with an additional comamnd line option -std=c++11, for example:

g++ -std=c++11 -o program program.cpp

Example data files

>>> [employee.dat] [tracking.dat] [smoke.dat] <<<

Your code should be general, and should work for any dataset that complies with the file formats.

You only may assume that the “tracking” and “smoke” data are given sorted in the order of increasing Timestamp.

User Interface

The program should provide the following Menu:

Main menu:
a - Report slackers.
b - Report suspected smokers.
c - Report employee's friends. 
d - Identify broken tracking devices.
e - Exit

The program should read the user input, and if it’s not a - e, it should print the menu again. If the user enters a - d the program should execute the corresponding section. If the user input is e, the program should exit.

Implementation

The program should be implemented using at least 4-5 classes and/or structures, in at least 3 files (for example, one header file, one implementation file, and one main file).

Always try to separate your code into functions and classes where it’s possible, especially where it makes your program more readable, more modular, or where it lets you reuse the code.

Think well about the program design, which classes and functions you may find useful. Don’t afraid changing the code that’s already written if you see an opportunity to make it better, even if it requires rewriting certain parts, but improves the overall structure of your program.

The quality of the overall program organization will be graded as well as the correctness of the program implementation.

You should write a Makefile for building your program, or write exact instructions how to compile the code from the command line using g++.