Programming Project 4: Days Out Concepts tested in this project Learn to organize code within a function Learn to pass data to and return data from a function Use of loops Use of output file...


Programming Project 4: Days Out




Concepts tested in this project






Learn to organize code within a function


Learn to pass data to and return data from a function


Use of loops


Use of output file processing





Project Description






Write a program that calculates the average number of days a company's employees are absent during the year and outputs a report on a file named "employeeAbsences.txt".





Project Specifications




Input for this project:



The user must enter the number of employees in the company.



The user must enter as integers for each employee:



The employee number (ID)



The number of days that employee missed during the past year.



Input Validation:


Do not accept a number less than 1 for the number of employees.


Do not accept a negative number for the days any employee missed.


Be sure to print an appropriate error message if either of these rules is violated and require the user to re-enter until they get it right.


The program must end when the data for the last employee has been entered and the report file has been written.




Output: The program should display the following data:




Each employee number (ID) and the number of days missed should be written to the report file named "employeeAbsences.txt".


The average number of days a company's employees are absenting during the year should be calculated and written to the report file named "employeeAbsences.txt".


The programmer’s name and the project due date should be displayed after the program runs.

























Processing Requirements






Create the following three functions that will be called by the main function:




A first function asks a user for the number of employees in the company. This value should be returned as an int. The function accepts no arguments.


A second function that does the following:


Asks the user to enter the following information for each employee:


The employee number (ID). Assume the employee number (ID) is 4 digits or fewer, but don't validate it.


The number of days that employee missed during the past year.


Writes each employee number (ID) and the number of days missed to the output file.


Returns the total of missed days as an int.


The function accepts two arguments:


The name of the file stream object as a reference parameter of type ofstream, and


The number of employees in the company as int.


A third function calculates the average number of days absent.


The function takes two arguments:


The number of employees in the company


The total number of days absent for all employees during the year.


The function should return, as a double, the average number of days absent.


This function does not perform screen or file output and does not ask the user for input.















































Sample Screen Output:







Sample File Output:

















Answer question in word document :


Create flowchart for the Program.


Create C++ file (source code) cpp.


Create output file called employeeAbsences.txt


Pseudocode


Test plan (table) with at least two different test cases with the corresponding output files and screenshots supporting each test case


Lessons Learned Section describing any issues you experienced during work on the project and how you solved them.





Note :


The program project needs to project description. Provide any additional comments as necessary to clarify the program.





Following is a template of the required program header:




Comments: Add comment to variables, formulas, or any part of the program with the purpose of making the source code easier to understand.




Indentation: It must be consistent throughout the program and must reflect the control structure.




Proper naming conventions: Variable, file object, and function names need to be descriptive to show the role of the variable, file, or function. Avoid single letter names. Constant names should be all upper-case, variable names should use “camel case” (i.e. start with lower case, with subsequent words starting with upper case:
hoursWorked
for example) or underscores to separate words (e.g. items_ordered).





Test Plan Template















































Test Case #




Input




Actual input








Expected Output




Actual Output




Did Test Pass?



1


















2



































10



























May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here