Reference no: EM132163009
A user a text file that contains the database of employees in the company. The file is in the following format.
FirstName LastName Salary Write a program to read the text file, and the display the content of the file on the screen in the following form
i) Allocate 20 spaces for the lastname and use right alignment. ii) Allocate 15 spaces for the firstname and use right alignment.
iii) Allocate 10 spaces for salary and use right alignment. The salary must have two significant digits after the decimal point.
Compute the average salary of the employees in the company and display the average on the screen. Use the file "HW6Prob1.dat" for this program.
HINT:
a) Declare string variables for read firstname and lastname. Remember to include the header file for using strings.
b) Read one line at a time, all three variables at once and display what you read from the file on the screen, one line at time.
c) Use a variable to sum the salary parameter and use a counter to track how many lines you have read.
HW6Prob1.dat
John Harris 50000
Lisa Smith 75000.487
Adam Johnson 68500
Sheila Smith 150000.50
Tristen Major 75800.76
Yannic Lennart 58000.55
Lorena Emil 43000.00
Tereza Santeri 48000.001