Question: Concepts tested by this program: 1. Learn to organize code within a function 2. Learn to pass data to and return data from a function
Concepts tested by this program: 1. Learn to organize code within a function 2. Learn to pass data to and return data from a function 3. Use of loops 4. Use of output file processing Program 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". The program should have the following functions: A function called by main that asks the user for the number of employees in the company. This value should be returned as an Int. (The function accepts no arguments.) A function called by main that accepts two arguments: the name of the file stream object as a reference parameter of type of stream, and the number of employees In the company. The function should ask the user to enter as integers for each employee: the employee number (ID) and the number of days that employee missed during the past year. Each employee number and the number of days missed should be written to the report file in this function. The total of these days should be returned as an Int. Assume the employee number (ID) is 4 digits or fewer, but don't validate it. A function called by main that takes two arguments: the number of employees In the company and 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.) 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 appropriate error messages for these Items If the input is invalid. Deliverables 1. A zip file named LastNameFirstName_projects.zip containing: a. A Word document that includes: Screen shots showing sample test data, (at least 2 of each-screen and file-different from those given. A flowchart showing your main function logic. Use a striped rectangle containing the name of the function for each function call. b. Your source code file called daysOut.cpp c. Output file called employeeAbsences.txt d. Test plan (table) with at least 2 different data files 2. A zip file named LastNameflrstName_ProJect5_MOSS.zip containing ONLY daysOut.cpp Concepts tested by this program: 1. Learn to organize code within a function 2. Learn to pass data to and return data from a function 3. Use of loops 4. Use of output file processing Program 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". The program should have the following functions: A function called by main that asks the user for the number of employees in the company. This value should be returned as an Int. (The function accepts no arguments.) A function called by main that accepts two arguments: the name of the file stream object as a reference parameter of type of stream, and the number of employees In the company. The function should ask the user to enter as integers for each employee: the employee number (ID) and the number of days that employee missed during the past year. Each employee number and the number of days missed should be written to the report file in this function. The total of these days should be returned as an Int. Assume the employee number (ID) is 4 digits or fewer, but don't validate it. A function called by main that takes two arguments: the number of employees In the company and 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.) 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 appropriate error messages for these Items If the input is invalid. Deliverables 1. A zip file named LastNameFirstName_projects.zip containing: a. A Word document that includes: Screen shots showing sample test data, (at least 2 of each-screen and file-different from those given. A flowchart showing your main function logic. Use a striped rectangle containing the name of the function for each function call. b. Your source code file called daysOut.cpp c. Output file called employeeAbsences.txt d. Test plan (table) with at least 2 different data files 2. A zip file named LastNameflrstName_ProJect5_MOSS.zip containing ONLY daysOut.cpp
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
