Question: 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

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 appropriate error messages for these items if the input is invalid.

Output: The program should display the following data:

display a students full name

display a due date

display the user full name

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 written to the report file named "employeeAbsences.txt".

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 for the following information each employee:

the employee number (ID)

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.

The function returns the total of missed days as an int. Assume the employee number (ID) is 4 digits or fewer, but don't validate it.

The function accepts two arguments:

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

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:

Concepts tested in this project Learn to organize code within a function

Sample File Output:

Learn to pass data to and return data from a function Use

Project Submission Requirements

Deliverables:

Flowchart for the Program.

C++ files (source code)

Output file

Documentation file

Documentl-Word Sign in File Home Insert Design Layout References Mailings Review View Tell me what you want to do Share Clipboard Paste All Clear All Click an tem to Paste: Clinboard emt Copy or cut to colect stem Mark C md.exe Please enter the number of enployees in the conpany: 5 eaac enter the number of daya this cnployee wa ahaent: 3 lease enter an enployee ID 22 eaae ente an enployce lease enter the umber ol days this enployee was absent 5 he nunber of dayutnot be negative easc e-entcr the nunher of daya ahaent: S lease enter an enployee ID: 4 ID: leas ent ahe nunber ofd yuthis enployee was alcemt: 1 casc enter an enlyee lease enter the number of days this enployee was absent 1 rogranner inert your name here Press any ley to continue Options Page 1 of 1 D words 10% 4:45 PM 1/12/2017

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!