Program4 - COSC1415/COSC1436 Program 4 Page 1 of 2 Name...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
COSC1415/COSC1436 Program 4 Page 1 of 2 Name Chintu Patel 8001 C++ Programming Assignment #4 TOPIC: Loops/Files/Void Functions/Value and Reference Parameters VALUE: 15 points DATE DUE: Wednesday, April 30 Program Statement Write a program that reads an employee's name, number of hours worked and hourly pay from a file. The number of entries in the file is not known. The program should calculate the weekly salary and write to a file each employee's name, hours worked, hourly pay and weekly salary. The program should use a while loop and continue to process until there is no more data in the file. In addition to the information on each employee, the program should collect and write to the file the following summary data: total number of employees, total hours worked, average hours worked, total weekly salary and average weekly salary. (This program should not use arrays.) Program Specifics: 1. Include a comment after each #include directive indicating the purpose of each header file. 2. Include a program heading that includes your name, the date, program number and program purpose. 3. Declare all variables after int main( ) . 4. Include a comment after each constant and variable declaration indicating what the constant or variable represents. 5. Follow C++ conventions for naming constants, variables and functions. 6. Your program should read data from a file and write the output to a file. 7. Whenever you pass a file variable (ifstream/ofstream) as a parameter it must be passed as a reference parameter. 8. Your program should use a while loop with a priming read (get the data before the while loop) and terminate when the end of the file is reached. 9. Your program should include at least four void functions. These functions should handle main tasks: input, output, and any calculations/processing. No calculations should appear in main. 10. Any person who works more than 40 hours a week is paid time and a half for additional hours. 10. Write each function parameter on a line by itself and indicate for each function parameter if the parameter is /*in*/, /*out*/ or /*inout*/. 11. After each function heading, include preconditions and postconditions. 12. Separate parts of your program with blank lines. 13. Use indentation so that the program is easy to read. 14. Run your program three times with the following files: dataA.txt, dataB.txt and dataC.txt.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
COSC1415/COSC1436 Program 4 Page 2 of 2 Output The output for your program should look very similar to the following: Employee Name Hours Worked Hourly Pay Weekly Salary abc 5.00 5.00 25.00 def 20.00 10.00 200.00 ghi 40.00 15.00 600.00 jkl 50.00 8.00 440.00 Number of Total Average Total Average Employees Hrs Worked Hrs Worked Wkly Salary WklySalary 4 115.00 28.75 1265.00 316.25 You will need to turn in, stapled to this page: 1. a listing of your program 2. a printed copy of the output using dataA.txt 3. a printed copy of the output using dataB.txt 4. a printed copy of the output using dataC.txt Program Heading
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 8

Program4 - COSC1415/COSC1436 Program 4 Page 1 of 2 Name...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online