hello, and happy new year!
i'd like you guys and girls to show me another or similar but a bit different way to write this code, which a simple employe class with 4 different sub-employers types. thanks. this code is not mine, and i need to write somethink like this but not exactly this way.

the code:

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


namespace ConsoleApplication1
{
    class Program
    {
      public static void Main(string[] args)
        {

            string name, lastName, bDate;
            
            SellsMan s;

            Console.WriteLine("Chois: mazkir(m)/sellsMan(s):");
            char chois = char.Parse(Console.ReadLine());

            if (chois == 'm')
                set_employe(name,lastName,bDate);
             Mazkir m = new Mazkir(name,lastName,bDate);
        }

       public static string set_employe(string name, string lastName, string bDate)
        {
            Console.Clear();
            Console.WriteLine("------------- Set Mazkir ----------\n\n");
            Console.WriteLine("Enter the name:");
            name = Console.ReadLine();
            Console.WriteLine("\nEnter the last name: ");
            lastName = Console.ReadLine();
            Console.WriteLine("\nEnter the BirthDate: ");
            bDate = Console.ReadLine();
           return name;
           return lastName;
           return bDate;
        }

       
        
    }



    class employe
    {
        private string name;
        private string lastNmae;
        private string bDate;
        private float salPerHour;
        private float hoursPerMonth;
        private float baseSal;
        private int sells;
        private int bonusPerSell;

        
        public employe(string name, string lastName, string bDate)
        {
            
            this.name = name;
            this.lastNmae = lastName;
            this.bDate = bDate;
        }

        
        
        
        public void setMazkir(float salPerHour, float hoursPerMonth)
        {
            this.salPerHour = salPerHour;
            this.hoursPerMonth = hoursPerMonth;
        }

        public void base_Sal(int baseSal)
        {
            this.baseSal = baseSal;
        }

        public void bonus_PerSell(int bonusPerSale)
        {
            this.bonusPerSell = bonusPerSale;
        }

        public void kamut_mechirot(int sells)
        {
            this.sells = sells;
        }


        public void Print()
        {
            Console.WriteLine("\n\nthe name is: {0}, last is: {1} and age is: {2}", name, lastNmae, bDate);
            Console.WriteLine("\nsal per hour is: {0}", salPerHour);
        }

    }

    class Mazkir : employe
    {

       
        public Mazkir(string name, string lastName, string bDate): base(name, lastName, bDate)
            
        {
            
        }

        

        public void salPerHour(float salPerHour, float hoursPerMonth)
        {
            base.setMazkir(salPerHour, hoursPerMonth);
        }


    }

    class SellsMan : employe
    {
        public SellsMan(string name, string lastName, string bDate)
            : base(name, lastName, bDate)
        {
        }

        public void setSellsMan(int baseSale, int Bonus, int sells)
        {
            base.base_Sal(baseSale);
            base.bonus_PerSell(Bonus);
            base.kamut_mechirot(sells);
        }

    }
}

this code is not mine, and i need to write somethink like this but not exactly this way.

That doesn't sound the least bit like you want us to help you cheat.

There's one good way to do what you want to accomplish, try it yourself and come back with questions about your code.

That doesn't sound the least bit like you want us to help you cheat.

There's one good way to do what you want to accomplish, try it yourself and come back with questions about your code.

first, i was fair enuff to say it is not mine, secund, i am realy dont know how i can improve that code, or change it but leave it like this. i even dont know where to start. may be change the names of variables, but i think its not enuf. so i am stuked. i have no problem do it by my self because it is a challenge for me too. but i am still new in c# so i cant do it by my self, thats the reason to ask for your help.

I think you understand my questioning your motives when you say (essentially) "this isn't mine but help me change things here and there just enough and turn this into a form which I can turn it in for a grade." Unfair to yourself and your classmates.

Now, we can start this over. You should post further details about your assignment along with an attempt at the employee class. Make a new Console application if you haven't already.

As a hint, you should probably separate your class into its own file. To do this, go to the Solution Explorer on the right side of the IDE (if you can't see it go to View/Solution Explorer). Right click on your project name (in bold). Select Add then select Class... name it and a file will show up in your project.

Also make a separate file for your derived class, the same way you did above except name it for your derived class.

Now layout the class in a skeleton with the methods unfinished and post back with any questions.

ok. i made some skitts, and i must say that i still stuked.
the code, now mine :) is:

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


namespace ConsoleApplication1
{
    class Program
    {
        public static void Main(string[] args)
        {

            string name, lastName, bDate;
            float sellPerHour, hoursPerMonth, basesallary, bonus;
            int sells,chois1;
           
            employe e = new employe();

            do
            {
                Console.WriteLine("chois: add = 1\tupdate = 2\tdelete = 3\tprint employe list = 4");
                chois1 = int.Parse(Console.ReadLine());
                switch (chois1)
                {
                    case 1:
                        {
                            
                            Console.WriteLine("Chois: secretary = 1\tsellsMan = 2\tManager = 3\tTopManager = 4");
                            char chois = char.Parse(Console.ReadLine());
                            switch (chois)
                            {
                                case '1':
                                    {
                                        set_employe(out name, out lastName, out bDate);
                                        set_secretary_sall(out sellPerHour, out hoursPerMonth);
                                        e = new employe(name, lastName, bDate);
                                        e.setsecretary(sellPerHour, hoursPerMonth);
                                        break;
                                    }
                                case '2':
                                    {
                                        set_employe(out name, out lastName, out bDate);
                                        e = new employe(name, lastName, bDate);
                                        set_sellsMan_salary(out basesallary, out sells, out bonus);
                                        e.base_Sal(basesallary);
                                        e.bonus_PerSell(bonus);
                                        e.sallss(sells);
                                        break;
                                    }
                                case '3':
                                    {
                                        set_employe(out name, out lastName, out bDate);
                                        e = new employe(name, lastName, bDate);
                                        set_manager(out basesallary, out bonus);
                                        e.base_Sal(basesallary);
                                        e.bonus_PerSell(bonus);
                                        break;
                                    }
                                case '4':
                                    {
                                        set_employe(out name, out lastName, out bDate);
                                        e = new employe(name, lastName, bDate);
                                        set_topManager(out basesallary, out bonus);
                                        e.base_Sal(basesallary);
                                        e.bonus_PerSell(bonus);
                                        break;
                                    }
                            }
                            break;
                        }
                    case 2:
                        {

                            break;
                        }
                    case 3:
                        {

                            break;
                        }
                    case 4:
                        {
                            e.Print();
                            break;
                        }
                }
            }
            while (chois1 > 4);
            
        }

        public static void set_employe(out string name, out string lastName, out string bDate)
        {
            
            Console.Clear();
            Console.WriteLine("------------- set employe ----------\n\n");
            Console.WriteLine("\nEnter the name:");
            name = Console.ReadLine();
            Console.WriteLine("\nEnter the last name: ");
            lastName = Console.ReadLine();
            Console.WriteLine("\nEnter the BirthDate: ");
            bDate = Console.ReadLine();

        }
        public static void set_secretary_sall(out float sellPerHour, out float hoursPerMonth)
        {
            Console.WriteLine("\nenter the base sallary: ");
            sellPerHour = float.Parse(Console.ReadLine());
            Console.WriteLine("enter the number of hours per month: ");
            hoursPerMonth = float.Parse(Console.ReadLine());
        }
        public static void set_sellsMan_salary(out float bs,out int sn, out float b)
        {
            Console.WriteLine("\nenter the base sallary: ");
            bs = float.Parse(Console.ReadLine());
            Console.WriteLine("enter the sells number: ");
            sn = int.Parse(Console.ReadLine());
            Console.WriteLine("enter the bonus for the sells: ");
            b = float.Parse(Console.ReadLine());
        }
        public static void set_manager(out float basesal, out float bonus)
        {
            Console.WriteLine("\nenter the base sallary: ");
            basesal = float.Parse(Console.ReadLine());
            bonus = 1500;
        }
        public static void set_topManager(out float basesal, out float bonus)
        {
            Console.WriteLine("\nenter the base sallary: ");
            basesal = float.Parse(Console.ReadLine());
            bonus = 5000;
        }
    }



    class employe
    {
        private string name;
        private string lastNmae;
        private string bDate;
        private float salaryPerHour;
        private float hoursPerMonth;
        private float baseSal;
        private int sells,count = 0;
        private float bonusPerSell;
        private float sallary;
        public int[] ar;
        public employe(string name, string lastName, string bDate)
        {
            count++;
            ar[count] = count;
            this.name = name;
            this.lastNmae = lastName;
            this.bDate = bDate;
        }

        public employe()
        {
            // TODO: Complete member initialization
        }




        public void setsecretary(float salPerHour, float hoursPerMonth)
        {
            this.salaryPerHour = salPerHour;
            this.hoursPerMonth = hoursPerMonth;
        }

        public void base_Sal(float baseSal)
        {
            this.baseSal = baseSal;
        }

        public void bonus_PerSell(float bonusPerSale)
        {
            this.bonusPerSell = bonusPerSale;
        }

        public void sallss(int sells)
        {
            this.sells = sells;
        }

        public float set_sallary()
        {
            sallary = bonusPerSell + baseSal;
            return sallary;
        }

        
        public void Print()
        {
            for(int i = 1;i < count;i++)
            {
                count++;
                ar[count] = count;
            Console.Clear();
            Console.WriteLine("name\tlast\tbirthdate\tsallary");
            Console.WriteLine("----\t----\t---------\t-------");
            Console.WriteLine("\n\n{0}\t{1}\t{2}\t{3}",name,lastNmae,bDate,sallary);
            }
        }

    }
}

so the qestions is;
1 - how can i return the base menu after i set new employe? i tried the do while loop, but probably i wrote it not correct.
2 - how can i count the employes for later use such as delete, update, print? i used array but i dont know how actualy get to every one of employes for check his data and manipulate this data.
3 - why i have some error issues while i run the program? error list is empty...

tahts all now, lets make this ones and then see if i understand...
thanks

ok. i made some skitts, and i must say that i still stuked.
the code, now mine :)

This is debatable, but you have put in some effort on your own.

so the qestions is;
1 - how can i return the base menu after i set new employe? i tried the do while loop, but probably i wrote it not correct.

I would put a 5th number in your menu for quit and then have the condition in your do/while be (chois1 !=5). If you're stuck with 4 choices, quit after the printout using a similar (chois1 !=4).

2 - how can i count the employes for later use such as delete, update, print? i used array but i dont know how actualy get to every one of employes for check his data and manipulate this data.

You can make a static variable in your class (which is sort of what you were trying to do but it wasn't declared properly). This is probably not the best way to do it. I would use the List container to hold each new object:
List <employe> employeeList = new List<employe>();
employeeList.Add(new employe( constructor arguments));
then use employeeList[0].setSecretary(method arguments); (and for 1,2,3,4....) or you could make a new employee, set it all up and then add it to the list.
That way you have a count of your employees

3 - why i have some error issues while i run the program? error list is empty...
tahts all now, lets make this ones and then see if i understand...
thanks

Just because something compiles doesn't mean it will run properly, there can still be runtime errors and logic errors.

One thing you might want to consider. It seems like this is an exercise involving inheritance, meaning the different employee types should be subclasses of the employee class. If this is the case you need to run through the section of your text on that topic and further revise your code.

ok. i tried the list that you recomend me, but, still have problems...
what wrong here? it says somethink about index must be non negative and less than the size of the collection.

switch (chois1)
                {
                    case 1:
                        {  
                            List <employe> employeeList = new List<employe>();
                            
                            Console.WriteLine("Chois: secretary = 1\tsellsMan = 2\tManager = 3\tTopManager = 4");
                            char chois = char.Parse(Console.ReadLine());
                            switch (chois)
                            {
                                case '1':
                                    {
                                        set_employe(out name, out lastName, out bDate);
                                        set_secretary_sall(out sellPerHour, out hoursPerMonth);
                                        employeeList[count].setsecretary(sellPerHour,hoursPerMonth); // here is the problem :(
                                        employeeList.Add(new employe( name, lastName, bDate));
                                        count++;

Do you initialize count before you try to access that element at EmployeeList[count]? Also, since you seemingly haven't added the first element until after you try to access it, there will be nothing in the container. What you should really do is move the Add() before you try to access the employeeList[] member.
As it is, rather than trying to create your own count variable, you can get employeeList.Count which is a field that will tell you how many objects are in the container (so you'd need to have access the last member as employeeList[employeeList.Count - 1]).

Post #7 code line 5. Why are you making a new employee list every time you add a new employee?

That's mybad for not taking enough notice of it.

now i realy confused...
can you actualy run the code to see what the problem is? i tried to move add() method before the count, and the problem not solved...

- i add every time employe because i dont know any other way... any sujestions? (sorry for my english)

now i confuse...
i have done what u said, and put the add() before the count... it is not realy helpd...
can u run the code and explain me what is the problem?

Post your code in its entirety. Also, please describe what problems you are having with it. What ddanbe was saying was that your declaration (and initialization) of employeeList should be at the level of Main() so that you are not creating it new every time your user selects option 1.

ok. the hole code is:

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


namespace ConsoleApplication1
{
    class Program
    {
        public static void Main(string[] args)
        {

            string name, lastName, bDate;
            float sellPerHour, hoursPerMonth, basesallary, bonus;
            int sells,chois1,count = 0;
           
            employe e = new employe();
           
            
            do
            {
                Console.WriteLine("chois: add = 1\tupdate = 2\tdelete = 3\tprint employe list = 4\tquit = 5");
                chois1 = int.Parse(Console.ReadLine());
                switch (chois1)
                {
                    case 1:
                        {  
                            List <employe> employeeList = new List<employe>();
                            
                            Console.WriteLine("Chois: secretary = 1\tsellsMan = 2\tManager = 3\tTopManager = 4");
                            char chois = char.Parse(Console.ReadLine());
                            switch (chois)
                            {
                                case '1':
                                    {
                                        set_employe(out name, out lastName, out bDate);
                                        set_secretary_sall(out sellPerHour, out hoursPerMonth);
                                        employeeList.Add(new employe(name, lastName, bDate));
                                        employeeList[count].setsecretary(sellPerHour,hoursPerMonth);                                        
                                        count++;
                                        
                                        //e = new employe(name, lastName, bDate);
                                       // e.setsecretary(sellPerHour, hoursPerMonth);
                                        break;
                                    }
                                case '2':
                                    {
                                        set_employe(out name, out lastName, out bDate);
                                        e = new employe(name, lastName, bDate);
                                        set_sellsMan_salary(out basesallary, out sells, out bonus);
                                        e.base_Sal(basesallary);
                                        e.bonus_PerSell(bonus);
                                        e.sallss(sells);
                                        break;
                                    }
                                case '3':
                                    {
                                        set_employe(out name, out lastName, out bDate);
                                        e = new employe(name, lastName, bDate);
                                        set_manager(out basesallary, out bonus);
                                        e.base_Sal(basesallary);
                                        e.bonus_PerSell(bonus);
                                        break;
                                    }
                                case '4':
                                    {
                                        set_employe(out name, out lastName, out bDate);
                                        e = new employe(name, lastName, bDate);
                                        set_topManager(out basesallary, out bonus);
                                        e.base_Sal(basesallary);
                                        e.bonus_PerSell(bonus);
                                        break;
                                    }
                            }
                            break;
                        }
                    case 2:
                        {

                            break;
                        }
                    case 3:
                        {

                            break;
                        }
                    case 4:
                        {
                            e.Print();
                            
                            break;
                        }
                    case 5:
                        {
                            break;
                        }
                }
            }
            while (chois1 != 5);
            
        }

        public static void set_employe(out string name, out string lastName, out string bDate)
        {
            
            Console.Clear();
            Console.WriteLine("------------- set employe ----------\n\n");
            Console.WriteLine("\nEnter the name:");
            name = Console.ReadLine();
            Console.WriteLine("\nEnter the last name: ");
            lastName = Console.ReadLine();
            Console.WriteLine("\nEnter the BirthDate: ");
            bDate = Console.ReadLine();

        }
        public static void set_secretary_sall(out float sellPerHour, out float hoursPerMonth)
        {
            Console.WriteLine("\nenter the base sallary: ");
            sellPerHour = float.Parse(Console.ReadLine());
            Console.WriteLine("enter the number of hours per month: ");
            hoursPerMonth = float.Parse(Console.ReadLine());
        }
        public static void set_sellsMan_salary(out float bs,out int sn, out float b)
        {
            Console.WriteLine("\nenter the base sallary: ");
            bs = float.Parse(Console.ReadLine());
            Console.WriteLine("enter the sells number: ");
            sn = int.Parse(Console.ReadLine());
            Console.WriteLine("enter the bonus for the sells: ");
            b = float.Parse(Console.ReadLine());
        }
        public static void set_manager(out float basesal, out float bonus)
        {
            Console.WriteLine("\nenter the base sallary: ");
            basesal = float.Parse(Console.ReadLine());
            bonus = 1500;
        }
        public static void set_topManager(out float basesal, out float bonus)
        {
            Console.WriteLine("\nenter the base sallary: ");
            basesal = float.Parse(Console.ReadLine());
            bonus = 5000;
        }
    }



    class employe
    {
        private string name;
        private string lastNmae;
        private string bDate;
        private float salaryPerHour;
        private float hoursPerMonth;
        private float baseSal;
        private int sells,count = 0;
        private float bonusPerSell;
        private float sallary;
     
        public employe(string name, string lastName, string bDate)
        {
            this.name = name;
            this.lastNmae = lastName;
            this.bDate = bDate;
        }

        public employe()
        {
            // TODO: Complete member initialization
        }




        public void setsecretary(float salPerHour, float hoursPerMonth)
        {
            this.salaryPerHour = salPerHour;
            this.hoursPerMonth = hoursPerMonth;
        }

        public void base_Sal(float baseSal)
        {
            this.baseSal = baseSal;
        }

        public void bonus_PerSell(float bonusPerSale)
        {
            this.bonusPerSell = bonusPerSale;
        }

        public void sallss(int sells)
        {
            this.sells = sells;
        }

        public float set_sallary()
        {
            sallary = bonusPerSell + baseSal;
            return sallary;
        }

        public void count1(int count)
        {
            this.count = count;           
        }
        
        public void Print()
        {
            
            for(int i = 1;i < count;i++)
            {
             
            Console.Clear();
            Console.WriteLine("name\tlast\tbirthdate\tsallary");
            Console.WriteLine("----\t----\t---------\t-------");
            Console.WriteLine("\n\n{0}\t{1}\t{2}\t{3}",name,lastNmae,bDate,sallary);
            }
        }

    }
}

and the question is , how can i contain all the employes that i will add to.
and how should look the add() method and where i put it?

Move your list declaration and instantiation outside of your do loop.

List<employe> employeeList = new List<employe>();

    do
    {
      Console.WriteLine("chois: add = 1\tupdate = 2\tdelete = 3\tprint employe list = 4\tquit = 5");
       chois1 = int.Parse(Console.ReadLine());
       switch (chois1)
       {
             case 1:
            {
               Console.WriteLine("Chois: secretary = 1\tsellsMan = 2\tManager = 3\tTopManager = 4");
                char chois = char.Parse(Console.ReadLine());
                switch (chois)
                 {
                     case '1':
                              {
                               set_employe(out name, out lastName, out bDate);
                               set_secretary_sall(out sellPerHour, out hoursPerMonth);
                                        //then still do your adding here
                               employeeList.Add(new employe(name, lastName, bDate));
                               employeeList[employeeList.Count-1].setsecretary(sellPerHour, hoursPerMonth);
                                        //get rid of all these things
                                         //count++;

                                        //e = new employe(name, lastName, bDate);
                                        // e.setsecretary(sellPerHour, hoursPerMonth);
                                        break;
                                    }

Change case 4 (of the main menu, to print)

case 4:
{
      foreach (employe emp in employeeList)
      {
          emp.Print();

       }

       break;
 }

And down in the print method, get rid of the for loop

public void Print()
      {
              Console.Clear();
              Console.WriteLine("name\tlast\tbirthdate\tsallary");
              Console.WriteLine("----\t----\t---------\t-------");
              Console.WriteLine("\n\n{0}\t{1}\t{2}\t{3}", name, lastNmae, bDate, sallary);
         
      }

I still remind you though, that your method for setting the employee data that you call probably should be a method of the employee class. Check your assignment and make sure there is not supposed to be inheritance between the employee class and the subtypes.


I still remind you though, that your method for setting the employee data that you call probably should be a method of the employee class. Check your assignment and make sure there is not supposed to be inheritance between the employee class and the subtypes.

first, thank you for learning me.. it is very nice... :)

so, you mean put the set() methods in the employe class? but how can do that? by not using constructors?

and why when i set more than one employe i get list of only one in the print() method when i chose '4' in the menu? i mean, i need to show all of the employes i have stored...

you mean put the set() methods in the employe class? but how can do that? by not using constructors?

Well, what you should do is have your secretary inherit from employee and either have the methods of secretary be the ones to get the monthly hours, etc. or call the constructor for secretary which would include the hours per month and then send all the other parameters to the employee constructor (the base).

public Secretary(string name, string lastName, string bDate, float baseSal,float hoursPerMonth)
            : base(name, lastName, bDate,baseSal)
        {
            this.hoursPerMonth = hoursPerMonth;

        }

But in terms of what you are doing, you can add the methods to get the data from the keyboard (set_employe and set_secretary, etc) as methods of the employee class. You would be writing to private members of the class just as if you called the constructor. But in fact nothing is stopping you from having both a setter function and a constructor that takes in the parameters. These are design decisions that may or may not be according to best practices but for your project you should pick one and stick to it.
One thing, though, if one of your menu functions is to edit your data you'll need some way to get access to those private variables.

and why when i set more than one employe i get list of only one in the print() method when i chose '4' in the menu? i mean, i need to show all of the employes i have stored...

Take out the Console.clear() call that you have in your Print() statement, you are clearing the screen in between each output. I'll leave it up to your creativity to get it so that it only prints the banner once and the rest with just the names.

hey... i did what u said, and it's works great. i've made some changes and get result.
now i did the 2 of the methods, add() and print().
the questipon, how i made the 2 others, update() and delete()?
in this methods i think i need to search in the dataBase ive made, how i do it? i think about some way which would be search by unic values...(name,lastname) maybe? but how?
create a method in the employe class which contains foreach loop? i dont know...

the updated code is:

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


namespace ConsoleApplication1
{
    class Program
    {
        public static void Main(string[] args)
        {

            string name, lastName, bDate;
            float sellPerHour, hoursPerMonth, basesallary, bonus, sal;
            int sells,chois1;
            List<employe> employeeList = new List<employe>();
           
           
            
            do
            {
                Console.WriteLine("chois: add = 1\tupdate = 2\tdelete = 3\tprint employe list = 4\tquit = 5");
                chois1 = int.Parse(Console.ReadLine());
                switch (chois1)
                {
                    case 1:
                        {  
                            
                            
                            Console.WriteLine("Chois: secretary = 1\tsellsMan = 2\tManager = 3\tTopManager = 4");
                            char chois = char.Parse(Console.ReadLine());
                            switch (chois)
                            {
                                case '1':
                                    {
                                        set_employe(out name, out lastName, out bDate);
                                        set_secretary_sall(out sellPerHour, out hoursPerMonth);
                                        sal = sellPerHour * hoursPerMonth;
                                        employeeList.Add(new employe(name, lastName, bDate, sal));
                                        break;
                                    }
                                case '2':
                                    {
                                        set_employe(out name, out lastName, out bDate);                                                                      
                                        set_sellsMan_salary(out basesallary, out sells, out bonus);
                                        sal = basesallary + bonus;
                                        employeeList.Add(new employe(name, lastName, bDate, sal));
                                        break;
                                    }
                                case '3':
                                    {
                                        set_employe(out name, out lastName, out bDate);                                        
                                        set_manager(out basesallary, out bonus);
                                        sal = basesallary + bonus;
                                        employeeList.Add(new employe(name, lastName, bDate, sal));
                                        break;
                                    }
                                case '4':
                                    {
                                        set_employe(out name, out lastName, out bDate);                                        
                                        set_topManager(out basesallary, out bonus);
                                        sal = basesallary + bonus;
                                        employeeList.Add(new employe(name, lastName, bDate, sal));
                                        break;
                                    }
                            }
                            break;
                        }
                    case 2:
                        {

                            break;
                        }
                    case 3:
                        {

                            break;
                        }
                    case 4:
                        {
                            Console.WriteLine("name\t\tlast\t\tbirthdate\t\tsallary");
                            Console.WriteLine("----\t\t----\t\t---------\t\t-------");
                            foreach (employe emp in employeeList)
                            emp.Print();                            
                            break;
                        }
                    case 5:
                        {
                            break;
                        }
                }
            }
            while (chois1 != 5);
            
        }

        public static void set_employe(out string name, out string lastName, out string bDate)
        {
            
            Console.Clear();
            Console.WriteLine("------------- set employe ----------\n\n");
            Console.WriteLine("\nEnter the name:");
            name = Console.ReadLine();
            Console.WriteLine("\nEnter the last name: ");
            lastName = Console.ReadLine();
            Console.WriteLine("\nEnter the BirthDate: ");
            bDate = Console.ReadLine();

        }
        public static void set_secretary_sall(out float sellPerHour, out float hoursPerMonth)
        {
            Console.WriteLine("\nenter the base sallary: ");
            sellPerHour = float.Parse(Console.ReadLine());
            Console.WriteLine("enter the number of hours per month: ");
            hoursPerMonth = float.Parse(Console.ReadLine());
            
        }
        public static void set_sellsMan_salary(out float bs,out int sn, out float b)
        {
            Console.WriteLine("\nenter the base sallary: ");
            bs = float.Parse(Console.ReadLine());
            Console.WriteLine("enter the sells number: ");
            sn = int.Parse(Console.ReadLine());
            Console.WriteLine("enter the bonus for the sells: ");
            b = float.Parse(Console.ReadLine());
        }
        public static void set_manager(out float basesal, out float bonus)
        {
            Console.WriteLine("\nenter the base sallary: ");
            basesal = float.Parse(Console.ReadLine());
            bonus = 1500;
        }
        public static void set_topManager(out float basesal, out float bonus)
        {
            Console.WriteLine("\nenter the base sallary: ");
            basesal = float.Parse(Console.ReadLine());
            bonus = 5000;
        }
    }



    class employe
    {
        private string name;
        private string lastNmae;
        private string bDate;
       // private float salaryPerHour;
       // private float hoursPerMonth;
       // private float baseSal;
          private int sells;
        //private float bonusPerSell;
        private float sallary;
        
     
        public employe(string name, string lastName, string bDate, float sal)
        {
            this.name = name;
            this.lastNmae = lastName;
            this.bDate = bDate;
            this.sallary = sal;
        }

       



        public void sallss(int sells)
        {
            this.sells = sells;
        }             
       
          
      public void Print()
      {         
         //Console.Clear();
         
         Console.WriteLine("\n{0}\t\t{1}\t\t{2}\t\t{3}", name, lastNmae, bDate, sallary);
      }

    }
}

how i made the 2 others, update() and delete()?

Well delete is easy but you can't use foreach since you are modifying the list during the process.
So for both processes (update and delete) make a search function as you suggested which returns the index of a matching criterion for example (employeeList.lastName == "Smith"), return i if this is true. Do this search using a regular for loop with i<employeeList.Count as your loop condition.
Then use employeeList.RemoveAt(i) to get rid of that one. I'll leave the Update() method to you, but suffice to say use that search function and return the index, then make the changes accordingly.

sorry, i didnt understand it... you mean that i shoud creat new list array?

No, using the same employeeList, sorry. Make a method like the following:

int SearchLast(List<employe> empList,string lastName)
{
          for loop over the whole list
           {       
                     if(lastName.ToLower() == empList[i].lastName.ToLower())
                              return i;
                     else
                              return -999 to main code for not found or  
                               another way you can think of
                              (could probably throw an exception but I don't 
                               know if you've crossed
                               paths with those yet) 
           }
}

note there are fancier ways to search your List item but this will suffice for your purposes (see http://msdn.microsoft.com/en-us/library/x0b5b5bc.aspx)

Then up in your menusystem in Main(), call your function from the delete one for example as employeeList.RemoveAt(SearchLast(employeeList,"Smith")); I'll leave the update method up to you but based on how you have designed things you may need to save the pertinent information to intermediate variables, delete the record, add it back in again as the updated record. The option then exists to have the getter and setter methods within your class so you can manipulate the information directly.

ok, i tried what u say and it is not worked...
but, i changed it a littlebit to:

Console.WriteLine("enter the last name of emloyee you like to remove: ");
                            string l = Console.ReadLine();
                            for (int i = 0; i < employeeList.Count; i++)
                                 {
                                     if (employeeList[i].Contains(l))
                                         {
                                           employeeList.RemoveAt(i); 
                                         }
                            }

and it is not work too... what is the problem now?

You'll need to put some "getter" methods in your employe class. For example:

public string getLastName()
      {
          return lastNmae;    //this is still your variable name you might want to change it

      }

and then use the contains on the string.  

employeeList[i].getLastName().ToLower().Contains("me")

As it is you were seeing if the list contained that string element but it won't look inside your objects to find it, I don't believe.

ok. thanks, i finished the program. :)

the final code is:

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


namespace ConsoleApplication1
{
    class Program
    {
        public static void Main(string[] args)
        {

            string name, lastName, bDate;
            float sellPerHour, hoursPerMonth, basesallary, bonus, sal;
            int sells, chois1;
            List<employe> employeeList = new List<employe>();



            do
            {
                Console.WriteLine("chois: add = 1\tupdate = 2\tdelete = 3\tprint employe list = 4\tquit = 5");
                chois1 = int.Parse(Console.ReadLine());
                switch (chois1)
                {
                    case 1:
                        {


                            Console.WriteLine("Chois: secretary = 1\tsellsMan = 2\tManager = 3\tTopManager = 4");
                            char chois = char.Parse(Console.ReadLine());
                            switch (chois)
                            {
                                case '1':
                                    {
                                        set_employe(out name, out lastName, out bDate);
                                        set_secretary_sall(out sellPerHour, out hoursPerMonth);
                                        sal = sellPerHour * hoursPerMonth;
                                        employeeList.Add(new employe(name, lastName, bDate, sal));
                                        break;
                                    }
                                case '2':
                                    {
                                        set_employe(out name, out lastName, out bDate);
                                        set_sellsMan_salary(out basesallary, out sells, out bonus);
                                        sal = basesallary + bonus;
                                        employeeList.Add(new employe(name, lastName, bDate, sal));
                                        break;
                                    }
                                case '3':
                                    {
                                        set_employe(out name, out lastName, out bDate);
                                        set_manager(out basesallary, out bonus);
                                        sal = basesallary + bonus;
                                        employeeList.Add(new employe(name, lastName, bDate, sal));
                                        break;
                                    }
                                case '4':
                                    {
                                        set_employe(out name, out lastName, out bDate);
                                        set_topManager(out basesallary, out bonus);
                                        sal = basesallary + bonus;
                                        employeeList.Add(new employe(name, lastName, bDate, sal));
                                        break;
                                    }
                            }
                            break;
                        }
                    case 2:
                        {
                            Console.WriteLine("enter the last name of emloyee you like to update: ");
                            string l = Console.ReadLine();

                            for (int i = 0; i < employeeList.Count; i++)
                            {
                                if (employeeList[i].getLastName().ToLower().Contains(l))
                                {
                                    employeeList.RemoveAt(i);
                                    Console.WriteLine("please, fill up the new parameters for the employee. "+
                                    "if you like to keep some details, just write them as they are,"+
                                    "and change the details you like to change. ");
                                    set_employe(out name, out lastName, out bDate);
                                    set_secretary_sall(out sellPerHour, out hoursPerMonth);
                                    sal = sellPerHour * hoursPerMonth;
                                    employeeList.Add(new employe(name, lastName, bDate, sal));                                    
                                }
                            }
                            break;
                        }
                    case 3:
                        {
                            Console.WriteLine("enter the last name of emloyee you like to remove: ");
                            string l = Console.ReadLine();                          

                            for (int i = 0; i < employeeList.Count; i++)
                                 {
                                     if (employeeList[i].getLastName().ToLower().Contains(l))
                                         {
                                           employeeList.RemoveAt(i); 
                                         }
                            }
                           
                            break;
                        }
                    case 4:
                        {
                            Console.WriteLine("name\t\tlast\t\tbirthdate\t\tsallary");
                            Console.WriteLine("----\t\t----\t\t---------\t\t-------");
                            foreach (employe emp in employeeList)
                                emp.Print();
                            break;
                        }
                    case 5:
                        {
                            break;
                        }
                }
            }
            while (chois1 != 5);

        }

        public static void set_employe(out string name, out string lastName, out string bDate)
        {

            Console.Clear();
            Console.WriteLine("------------- set employe ----------\n\n");
            Console.WriteLine("\nEnter the name:");
            name = Console.ReadLine();
            Console.WriteLine("\nEnter the last name: ");
            lastName = Console.ReadLine();
            Console.WriteLine("\nEnter the BirthDate: ");
            bDate = Console.ReadLine();

        }
        public static void set_secretary_sall(out float sellPerHour, out float hoursPerMonth)
        {
            Console.WriteLine("\nenter the base sallary: ");
            sellPerHour = float.Parse(Console.ReadLine());
            Console.WriteLine("enter the number of hours per month: ");
            hoursPerMonth = float.Parse(Console.ReadLine());

        }
        public static void set_sellsMan_salary(out float bs, out int sn, out float b)
        {
            Console.WriteLine("\nenter the base sallary: ");
            bs = float.Parse(Console.ReadLine());
            Console.WriteLine("enter the sells number: ");
            sn = int.Parse(Console.ReadLine());
            Console.WriteLine("enter the bonus for the sells: ");
            b = float.Parse(Console.ReadLine());
        }
        public static void set_manager(out float basesal, out float bonus)
        {
            Console.WriteLine("\nenter the base sallary: ");
            basesal = float.Parse(Console.ReadLine());
            bonus = 1500;
        }
        public static void set_topManager(out float basesal, out float bonus)
        {
            Console.WriteLine("\nenter the base sallary: ");
            basesal = float.Parse(Console.ReadLine());
            bonus = 5000;
        }     
                  
              
               
    }



    class employe
    {
        private string name;
        private string lastNmae;
        private string bDate;       
        private int sells;
        private float sallary;
        
     
        public employe(string name, string lastName, string bDate, float sal)
        {
            this.name = name;
            this.lastNmae = lastName;
            this.bDate = bDate;
            this.sallary = sal;
        }     
        
        public void sallss(int sells)
        {
            this.sells = sells;
        }

        public string getLastName()
        {
            return lastNmae;
        }
       
          
      public void Print()
      {                         
         Console.WriteLine("\n{0}\t\t{1}\t\t{2}\t\t{3}", name, lastNmae, bDate, sallary);
      }




      internal bool Contains(string l)
      {
          throw new NotImplementedException();
      }

      
    }
}

No problem! Nice job seeing it through.

commented: Nice guidance! +6
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.