Question

In C# Create an “EmployeeDemo” class. It includes three functions: 1. In the main function, the...

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.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

// Code as shown below //

/* program for employee demo class*/

#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("\nEnter the employee number : ") ;

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

printf("\nEnter the name : ") ;

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

printf("\nEnter 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("\nEmp. No. Name \t Bpay \t Allow \t Ded \t Npay \n\n") ;

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

{

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

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

}

getch() ;

}

Add a comment
Know the answer?
Add Answer to:
In C# Create an “EmployeeDemo” class. It includes three functions: 1. In the main function, the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C# Language please. Create an “Employee” class with six fields: first name, last name, workID, yearStartedWked,...

    C# Language please. Create an “Employee” class with six fields: first name, last name, workID, yearStartedWked, initSalary, and curSalary. It includes constructor(s) and properties to initialize values for all fields (curSalary is read-only). It also includes a calcCurSalary function that assigns the curSalary equal to initSalary. Create a “Worker” classes that are derived from Employee class.  In Worker class, it has one field, yearWorked. It includes constructor(s) and properties. It also includes two functions: first, calcYearWorked function, it takes...

  • Create a class “Person” which includes first name, last name, age, gender, salary, and haveKids (Boolean)...

    Create a class “Person” which includes first name, last name, age, gender, salary, and haveKids (Boolean) variables. You have to create constructors and properties for the class. Create a “MatchingDemo” class. In the main function, the program reads the number of people in the database from a “PersonInfo.txt” file and creates a dynamic array of the object. It also reads the peoples information from “PersonInfo.txt” file and saves them into the array. In C# Give the user the ability to...

  • Create a program called Merge.java that implements a variety of the Merge function (in the Merge...

    Create a program called Merge.java that implements a variety of the Merge function (in the Merge Sort algorithm). The program should be able to do the following: accepts two command line parameters, each specifies a text file containing the integers to be merged. The structure of the files is as follows: For both files, there will be multiple lines, each of which contains one integer. The number of lines is unknown. reads the integers from the text files into two...

  • C++ Problems: 1. Write a program that reads in an array of user given size n and then it reads se...

    C++ Problems: 1. Write a program that reads in an array of user given size n and then it reads several increment values terminated by 0. The program calls each time a function incarray() that accepts an array A, its size S and an increment value inc and updates yje array by incrementing all its values by the passed value of inc. The program prints out the array after each update. 2. write a program that reads in a n...

  • IN C++ ADD COMMENTS AS MUCH AS POSSIBLE Exercise 1: Duplicate the Arrays Suppose you are...

    IN C++ ADD COMMENTS AS MUCH AS POSSIBLE Exercise 1: Duplicate the Arrays Suppose you are developing a program that works with arrays of integers, and you find that you frequently need to duplicate the arrays. Rather than rewriting the array-duplicating code each time you need it, you decide to write a function that accepts an array and its size as arguments. Creates a new array that is a copy of the argument array, and returns a pointer to the...

  • Write a C++ program that asks user number of students in a class and their names....

    Write a C++ program that asks user number of students in a class and their names. Number of students are limited to 100 maximum. Then, it will ask for 3 test scores of each student. The program will calculate the average of test scores for each student and display with their names. Then, it will sort the averages in descending order and display the sorted list with students’ names and ranking. Follow the Steps Below Save the project as A4_StudentRanking_yourname....

  • with C++ You will create a program that uses a Critter class to move around a...

    with C++ You will create a program that uses a Critter class to move around a Grid, which is also a class. The Critter and the Grid classes will be in separate files. The Critter class will have a data member to count the number of moves made. It will also need data members to hold the current x and y coordinates. It will have a member function that randomly moves it one space in one of 4 directions. You...

  • *Using C++* You will create a program that uses a Critter class to move around a...

    *Using C++* You will create a program that uses a Critter class to move around a Grid, which is also a class. The Critter and the Grid classes will be in separate files. The Critter class will have a data member to count the number of moves made. It will also need data members to hold the current x and y coordinates. It will have a member function that randomly moves it one space in one of 4 directions. You...

  • E2a: Create a class called Employee that includes three pieces of information as data members---a first...

    E2a: Create a class called Employee that includes three pieces of information as data members---a first name (char array), last name (char array) and a monthly salary (integer). Your class should have a constructor that initializes the three data members. If the monthly salary is not positive, set it to 0. Write a test program that demonstrates class Employee’s capabilities. Create two Employee objects and display each object’s yearly salary. Then give each Employee a 10 percent raise and display...

  • Programming languages allow the programmer to create his or her own functions which are called __________...

    Programming languages allow the programmer to create his or her own functions which are called __________ __________ functions. The function that returns the number of characters in a string is the __________ function. __________ files contain records that must be processed in the order in which they were created. The elements of an array are stored in __________ storage locations in the computer’s memory. A variable that is declared outside all program modules, including the main module, has __________ scope....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT