Hello Guys! Welcome To My Blog!
HOW TO GET EMPLOYEE INFORMATION BY METHOD
Today we will be Learn how to get employee Information In this Code we used Method
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace method
{
class Program
{
void employeeRecord()//Employee Record Method
{
while (true)
{
Console.WriteLine("Enter Name Note: if you want to close program type no");//If you want to Program break type no otherwise it will go on!
string name = Console.ReadLine();//this string variable used for get Employee name
if (name =="no")
{
break;//if user want to break program type no
}
Console.WriteLine("Enter Roll no");//this int variable used for get Employee Roll:no
int rollno = int.Parse(Console.ReadLine());
Console.WriteLine("Enter Age");//this int variable used for get Employee age
int age = int.Parse(Console.ReadLine());
Console.WriteLine("Enter salary");//this int variable used for get Employee Salary
int salary = int.Parse(Console.ReadLine());
Console.WriteLine("Employee Information");
Console.WriteLine("\nName of Employee is " + name + "\n Employee Roll No is "+rollno + "\n Age of Employee is " + age + "\n Employee Salary is " + salary);
Console.WriteLine(" Thankyou! ");
}
}
static void Main(string[] args)
{
Program obj = new Program();//we have to made class(program)object to access method
obj. employeeRecord();//After making a method we have to access it it is necessary otherwise the program will not run
Console.ReadLine();
}
}
}
Comments
Post a Comment