Computer Science, asked by psatyam9202, 6 months ago

Write a program in java to accept employee name,employee id,designation and calculate salary ta da in variable

Answers

Answered by asitpaul2015ap
1

Answer:

class Employee

{

public string name;

public int salary;

public int joiningDate;

public Employee()

{

}

public Employee(string name, int salary, int joiningDate)

{

this.name = name;

this.salary = salary;

this.joiningDate = joiningDate;

}

public void GetEmployeeData()

{

{

Console.WriteLine("Enter the name of employee: ");

name = Convert.ToString(Console.ReadLine());

Console.WriteLine("Enter the salary of employee: ");

salary = Convert.ToInt32(Console.ReadLine());

Console.WriteLine("Enter the date of joining of employee: ");

joiningDate = Convert.ToInt32(Console.ReadLine());

}

}

public void DisplayEmployee()

{

Console.WriteLine("The name of employee is: "+ name);

Console.WriteLine("The salary of employee is: "+salary);

Console.WriteLine("The date of joining of employee is: "+joiningDate);

}

}

class Program

{

static void Main(string[] args)

{

Employee[] e = new Employee[10];

for(int i = 0; i < 10; i++)

{

Console.WriteLine($"Enter the data of employee with id: {i} *****************************************");

e[i] = new Employee();

e[i].GetEmployeeData();

}

Console.WriteLine("***********The data of given employees is: ");

for(int i = 0; i < 10; i++)

{

e[i].DisplayEmployee();

}

}

}

Answered by BrainlyWeb
38

\mathtt{\mathfrak{\underline{\blue{ Required \;Programme:-}}}}

{\\Java

class Employee

{

public string name;

public int salary;

public int joiningDate;

public Employee()

{

}

public Employee(Karam, 40000, 11-04-2001)

{

this.name = karam;

this.salary =40000 ;

this.joiningDate =11-04-2001 ;

}

public void GetEmployeeData()

{

{

public void DisplayEmployee()

{

("The name of employee is: "+ Shiv);

Console.WriteLine("The salary of employee is: "+30000);

Console.WriteLine("The date of joining of employee is: "+16-06-2003);

}

}

public Employee(Shiv, 30000,16-06-2003 )

class Program

{

static void Main(string[] args)

{

Employee[] e = new Employee[10];

for(int i = 0; i < 10; i++)

for(int i = 0; i < 10; i++)

{

e].DisplayEmployee();

}

}

}

\mathtt{\mathfrak{\underline{\pink{ Required \;Output:-}}}}

\tt{Name: Karamchand}

\tt{SSN: 11-04-2001}

\tt{Salary : 40000}

_________________

\tt{Name: shiksha}

\tt{SSN: 16- 06-2003}

\tt{Salary : 30000}

_________________

Similar questions