Define the following structure in your program and initialize the values after reading from a file “emp.txt”. struct perSalary { int month; /* number 1 is January,2 is February and so on..*/long salary; }; struct employee { int empnr; /* Employee number */ char name[12]; /* Employee name */ struct perSalary salaries[3]; /* three months salaries */ long total; /* Sum of 3 months salaries */ float average;/* Average of 3 months salaries*/ }; A) Using the above structure define an array of structure employee for 4 person that will be initialized using a data file(named emp.txt) which has the following data in it. Using Notepad create the following file 121 Ahmet 2 300000 4 400000 12 750000 234 Ayse 3 250000 6 800000 7 475000 456 Mehmet 4 750000 5 880000 10 660000 875 Sevgi 2 950000 4 660000 9 775000 B) Write a function that displays the initialized values as shown below. Note that the integer values corresponding to months are converted to the proper   month names. This can be achieved by declaring an array of the month names.   Employee NrNameMonthSalary         121Ahmet February 300000April 400000December750000 234 Ayse March250000June 800000July 475000 456 Mehmet April 750000May 880000October660000 875 Sevgi February 950000 April 660000 September 775000 C) Write a function that computes for each employee the Average and the Sum of the three months’ salaries and sets the values of the corresponding variables in each record and display the output as follows.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Define the following structure in your program and initialize the values after reading from a file “emp.txt”.

struct perSalary
{ int month; /* number 1 is January,2 is February and so on..*/long salary;
};
struct employee
{
int empnr; /* Employee number */
char name[12]; /* Employee name */
struct perSalary salaries[3]; /* three months salaries */
long total; /* Sum of 3 months salaries */
float average;/* Average of 3 months salaries*/
};
A) Using the above structure define an array of structure employee for 4 person that will be initialized using a data file(named emp.txt) which has the following data in it. Using Notepad create the following file
121 Ahmet 2 300000 4 400000 12 750000 234 Ayse 3 250000 6 800000 7 475000 456 Mehmet 4 750000 5 880000 10 660000
875 Sevgi 2 950000 4 660000 9 775000
B) Write a function that displays the initialized values as shown below. Note that the integer values corresponding to months are converted to the proper
 
month names. This can be achieved by declaring an array of the month names.
 
Employee NrNameMonthSalary
 
 
 
 
121Ahmet February 300000April 400000December750000 234 Ayse March250000June 800000July 475000 456 Mehmet April 750000May 880000October660000
875 Sevgi February 950000
April 660000
September 775000
C) Write a function that computes for each employee the Average and the Sum of the three months’ salaries and sets the values of the corresponding variables in each record and display the output as follows.
5) Define the following structure in your program and initialize the values
after reading from a file “emp.txt".
struct perSalary
{
int month; /* number 1 is January,
long salary;
};
struct employee
{
int empnr;
char name[12]; /* Employee name */
struct perSalary salaries[3]; /* three months salaries */
long total; /* Sum of 3 months salaries */
float average;
};
2 is February and so on..*/
* Employee number */
/* Average of 3 months salaries*/
A) Using the above structure define an array of structure employee for 4
person that will be initialized using a data file(named emp.txt) which has the
following data in it. Using Notepad create the following file
121 Ahmet 2 300000 4 400000 12 750000
234 Ayse
456 Mehmet 4 750000 5 880000 10 660000
875 Sevgi
3 250000 6 800000 7 475000
2 950000 4 660000
9 775000
Transcribed Image Text:5) Define the following structure in your program and initialize the values after reading from a file “emp.txt". struct perSalary { int month; /* number 1 is January, long salary; }; struct employee { int empnr; char name[12]; /* Employee name */ struct perSalary salaries[3]; /* three months salaries */ long total; /* Sum of 3 months salaries */ float average; }; 2 is February and so on..*/ * Employee number */ /* Average of 3 months salaries*/ A) Using the above structure define an array of structure employee for 4 person that will be initialized using a data file(named emp.txt) which has the following data in it. Using Notepad create the following file 121 Ahmet 2 300000 4 400000 12 750000 234 Ayse 456 Mehmet 4 750000 5 880000 10 660000 875 Sevgi 3 250000 6 800000 7 475000 2 950000 4 660000 9 775000
B) Write a function that displays the initialized values as shown below.
Note that the integer values corresponding to months are converted to the proper
month names. This can be achieved by declaring an array of the month names.
Employee Nr
Month
Salary
300000
Name
Ahmet
February
April
December 750000
March
June
July
April
May
October
February
Аpril
September 775000
121
400000
234
Ayse
250000
800000
475000
456
Mehmet
750000
880000
660000
875
Sevgi
950000
660000
C) Write a function that computes for each employee the Average and the Sum of
the three months' salaries and sets the values of the corresponding variables in
each record and display the output as follows.
Transcribed Image Text:B) Write a function that displays the initialized values as shown below. Note that the integer values corresponding to months are converted to the proper month names. This can be achieved by declaring an array of the month names. Employee Nr Month Salary 300000 Name Ahmet February April December 750000 March June July April May October February Аpril September 775000 121 400000 234 Ayse 250000 800000 475000 456 Mehmet 750000 880000 660000 875 Sevgi 950000 660000 C) Write a function that computes for each employee the Average and the Sum of the three months' salaries and sets the values of the corresponding variables in each record and display the output as follows.
Expert Solution
steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY