Question
Part 1 (0%) The first portion of this workshop consists of modules: w8 (supplied) EmpProfile (incomplete) GeneratingList (incomplete) WritingRecord (supplied header, incomplete implementation) Your tasks
Part 1 (0%)
The first portion of this workshop consists of modules:
- w8 (supplied)
- EmpProfile (incomplete)
- GeneratingList (incomplete)
- WritingRecord (supplied header, incomplete implementation)
Your tasks for this part of the workshop are:
- Add a rangeValidator() function to the EmpProfile module
- Add an operator += overload to the GeneratingList module using raw pointer syntax
- Add an implementation of Luhn Algorithm to the GeneratingList module to validate the SIN
- Complete the writeRaw() function in the WritingRecord module using raw pointer syntax
EmpProfile Module
The EmpProfile module holds employee, salary and correct wages information.
- The Employee structure holds employee SIN and employee name.
- The Salary structure holds employee SIN and current salary.
- The EmployeeWage structure holds employee name and employee salary.
Your Task: Add a rangeValidator() function to the EmploeeWage type. Your function reports an exception if the object's salary is more than 99,999 or less than 0. Your function receives nothing and returns nothing.
GeneratingList Module
The GeneratingList module defines a class that retrieves a list of records stored in a text file, holds the elements in an STL vector, provides access to them by index and displays them to an output stream.
Your Task:
- Add an operator += overload to the GeneratingList template. Your function receives the address of an object to be stored in the GeneratingList container and moves the object into that container. Your overload returns nothing.
- Add an implementation of Luhn's Algorithm to check the validity of the SIN. Your function receives a reference of a const std::string type representing the SIN to check and return true if the SIN is valid, false otherwise.
WritingRecord Module
Your Task: Implement the writeRaw() function. This function creates a list of active employees; an employee is considered active if both lists received as parameters contain an employee with the same SIN. For each active employee found in both lists, dynamically create a new object of type EmployeeWage and add it to the collection activeEmp only if it passes both validations below:
- validate the salary before adding it using the function you defined above
- validate the SIN using Luhn's algorithm you implemented above; if the SIN doesn't pass validation, generate an exception of type std::string
w8 Module (supplied)
The tester module has been supplied. Do not modify the existing code!
When doing the workshop, you are encouraged to write your own tests, focusing on a single implemented feature at the time, until you get all functionality in place.
Sample Output
When the program is started with the command (the input files are provided):
ws NamesSIN.dat CorrectSalary.dat WrongSalary.dat
the output should look like the one from the sample_output.txt file.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started