Computer Science, asked by sparshtaneja969, 6 months ago

Q5. WAP in java for the following specification:

Data members:

name[] array to store names of 20 employees.

netsal[] array to store net salary of 20 employees.

Member functions:

void input() to accept names of 20 employees and their corresponding net salaries.

void selection() to sort the array netsal in descending order and arrange the names

accordingly.

void print() to print the sorted data in the following format.​

Attachments:

Answers

Answered by james129724
0

(a) Define encapsulation.

The wrapping of data and methods that operate on that data into a single unit is called Encapsulation.

(b) Explain the purpose of using a 'new' keyword in a Java program.

The new keyword instantiates an array or a class by dynamically allocating memory for it at runtime and returning a reference to that memory.

For example,

Employee emp = new Employee();

Here we are creating an object of class Employee using the new keyword.

(c) What are literals?

Any constant value which can be assigned to the variable is called as literal. There are different types of literals like integer literals, floating point literals, character literals, String literals, boolean literals and null literals.

Similar questions