Header Ads

Header ADS

Employee name, Employee id, Department and Designation Program

Employee name, Employee id, Department and Designation Program

Object


Create a class Employee having multiple constructors with different set of parameters. Use employee name, employee id, department and designation. Also write functions for getData() and displayData().


Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication3
{
    class emp
    {
        string e_name;
        string email;
        string design;
        string dept;
        public emp()
        {
            e_name = "Adeel Satti ";
            email = "Silent_friend2010@yahoo.com";
            design = "Engineer";
            dept = "IT DEVELOPMENT";

        }

        public emp(string a)
        {
            e_name = a;
        }
        public emp(string b, string a)
        {
            email = b;
            e_name = a;
        }

        public emp(string d, string b, string a)
        {
            design = d;
            email = b;
            e_name = a;
        }
        public emp(string d, string c, string b, string a)
        {
            design = d;

            email = b;
            e_name = a;
            dept = c;
        }

        public void get_data()
        {

        }
        public void disp_data()
        {
            Console.WriteLine("Employe name is ={0}", e_name);
            Console.WriteLine("Email is  ={0}", email);
            Console.WriteLine("Design  ={0}", design);
            Console.WriteLine("Department  ={0}", dept);

        }


        class program
        {
            static void Main(string[] args)
            {
                emp rehan = new emp("ENGINEER", "IT", "SILENT_FRIEND2010@YAHOO.COM", "ADEEL SATTI");
                rehan.disp_data();

            }

        }
    }
}

Screen Shot

No comments

Powered by Blogger.