In C Create an EmployeeDemo class It includes three function

In C#

Create an “EmployeeDemo” class. It includes three functions:

1. In the main function, the program calls the readData() function to get the data from file and calls the objSort() function to sort the array of objects. Then, the program prompts user to enter the range of current salary that user want to see and display the employee’s information whose current salary is in the range in a descending order.

2. readData(): it reads the workers and managers information from files (“worker.txt” and “manager.txt”) and then creates the dynamic arrays of objects to save the data. Then, it prompts user for the current year to calculate the yearWorked and currentSalary.

3. objSort(): this function accepts an array of object as a parameter and sort the array by current salary in descending order.

Solution

#include<stdio.h>

#include<conio.h>

struct emp

{

    int empno ;

    char name[10] ;

    int bpay, allow, ded, npay ;

} e[10] ;

void main()

{

    int i, n ;

    clrscr() ;

    printf(\"Enter the number of employees : \") ;

    scanf(\"%d\", &n) ;

    for(i = 0 ; i < n ; i++)

    {

        printf(\"\ Enter the employee number : \") ;

        scanf(\"%d\", &e[i].empno) ;

        printf(\"\ Enter the name : \") ;

        scanf(\"%s\", e[i].name) ;

        printf(\"\ Enter the basic pay, allowances & deductions : \") ;

        scanf(\"%d %d %d\", &e[i].bpay, &e[i].allow, &e[i].ded) ;

        e[i].npay = e[i].bpay + e[i].allow - e[i].ded ;

    }

    printf(\"\ Emp. No. Name \\t Bpay \\t Allow \\t Ded \\t Npay \ \ \") ;

    for(i = 0 ; i < n ; i++)

    {

        printf(\"%d \\t %s \\t %d \\t %d \\t %d \\t %d \ \", e[i].empno,

        e[i].name, e[i].bpay, e[i].allow, e[i].ded, e[i].npay) ;

    }

    getch() ;

}

In C# Create an “EmployeeDemo” class. It includes three functions: 1. In the main function, the program calls the readData() function to get the data from file
In C# Create an “EmployeeDemo” class. It includes three functions: 1. In the main function, the program calls the readData() function to get the data from file

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site