c# oop, is that correct? I have kinda problem with oop in c#, I need to do a task to school but I completely new in oop. At this moment I have no idea how I can even start this, I mean I don't know how to make that program counts people... like e.g. click spacebar and it will make counter of people increase. Maybe someone could help me to solve this out. The task is:

Create a class(called Counter) that will check how many people entered the building(like the gate in the entrance counts how many people entered or how many is inside already). The class should contain a methods that will singly increase amount of people or singly decreases amount of them, the third method should show how many is inside already. Last but not least, the constructor for counter should be set as 0.

I managed to create some code, I'm not sure if it's good solution for this task, for sure there's a way to make it better, or to optimize this, I still learn this, so I just ask you guys for the opinion about it, or maybe some hints.

Sorry for my broken English!

using System;

namespace zaliczenie6test 
 { 
    class Program 
     { 
       static void Main(string[] args) 
        { 
           Counter gate = new Counter(); 
           char wybor;

            Console.WriteLine("If you want to enter the building(through
            the gate) press 'p', if you want to leave the building press
            'd', if you want check how many people is inside press 'c'
             : ");
        do
        {
            Console.Write("Enter your choice: ");
            wybor = char.Parse(Console.ReadLine());
            if (wybor == 'p')
            {
                Counter gate2 = new Counter();
                gate2.IncNr(wybor);
                gate.Count(wybor);
            }
            else if(wybor == 'd')
            {
                Counter gate3 = new Counter();
                gate3.DecNr(wybor);
                gate.Count(wybor);
            }
        } while (wybor != 'c');
        if (wybor == 'c')
        {
            gate.CheckNr(wybor);
        }






        Console.ReadKey();
    }
}

   class Counter
  {
    private int _licznik;
    private int quantity;
    public int Licznik { get { return _licznik; } set { _licznik =
    value; }
  }

    public Counter()
    {
        _licznik = 0;
    }

    public void IncNr(char wybor)
    {
        if(wybor=='p')
        {
            Licznik += 1;
            Console.WriteLine("The amount of people that just enteredthe
            building through the gate: {0}\n",Licznik);
        }
    }
    public void CheckNr(char wybor)
    {
        if(wybor=='c')
        {
            Console.WriteLine("The current amount of people: {0}",
            quantity);
        }
    }

    public void Count(char wybor)
    {
        if(wybor == 'p')
        {
            quantity += 1;

        }
        else if(wybor == 'd')
        {
            quantity -= 1;
        }
    }

    public void DecNr(char wybor)
    {
        if(wybor == 'd')
        {
            Licznik += 1;
            Console.WriteLine("The amount of people that just passed the
            gate toward the exit is: {0}\n", Licznik);
        }
    }
  }
}
First things first, you need to fix your indentation. It'll make it much easier to follow what's happening. Here's your code properly formatted:

using System;

namespace zaliczenie6test 
{     
    class Program 
    { 
        static void Main(string[] args) 
        { 
            Counter gate = new Counter(); 
            char wybor;

            Console.WriteLine("If you want to enter the building(through the gate) press 'p', if you want to leave the building press 'd', if you want check how many people is inside press 'c': ");
            do
            {
                Console.Write("Enter your choice: ");
                wybor = char.Parse(Console.ReadLine());
                if (wybor == 'p')
                {
                    Counter gate2 = new Counter();
                    gate2.IncNr(wybor);
                    gate.Count(wybor);
                }
                else if (wybor == 'd')
                {
                    Counter gate3 = new Counter();
                    gate3.DecNr(wybor);
                    gate.Count(wybor);
                }
            } while (wybor != 'c');
            if (wybor == 'c')
            {
                gate.CheckNr(wybor);
            }   
            Console.ReadKey();
        }
    }

    class Counter
    {
        private int _licznik;
        private int quantity;
        public int Licznik
        {
            get { return _licznik; }
            set { _licznik = value; }
        }

        public Counter()
        {
            _licznik = 0;
        }

        public void IncNr(char wybor)
        {
            if (wybor == 'p')
            {
                Licznik += 1;
                Console.WriteLine("The amount of people that just entered the building through the gate: { 0}\n", Licznik);
            }
        }
        public void CheckNr(char wybor)
        {
            if (wybor == 'c')
            {
                Console.WriteLine("The current amount of people: {0}", quantity);
            }
        }

        public void Count(char wybor)
        {
            if (wybor == 'p')
            {
                quantity += 1;
            }
            else if (wybor == 'd')
            {
                quantity -= 1;
            }
        }

        public void DecNr(char wybor)
        {
            if (wybor == 'd')
            {
                Licznik += 1;
                Console.WriteLine("The amount of people that just passed the gate toward the exit is: { 0}\n", Licznik);
            }
        }
    }
}


You're also mixing English and Polish - try to stick to one language (Licznik vs quantity). 


  The class should contain a methods that will singly increase amount of people or singly decreases amount of them, the third method should show how many is inside already. Last but not least, the constructor for counter should be set as 0.


This is worded a bit ambiguously, but I'll put that down to the translation. From my understanding, it wants you to make three functions


Increment the counter
Decrement the counter
Return the count


It also mentions the difference between the number of entries and the current amount of people in the building, so you might need an additional method to return the total number of entries (ignoring the exits).

You've got those methods, but they're being passed an argument (the choice made). Those methods don't need any argument - they do one thing only. It's the responsibility of the caller to determine which to call (increment, decrement, or show the count). Also, the methods aren't very clear. What is IncNr? What's the Nr represent here? I suspect this may be 'Increment Number', but that's not very clear. Use descriptive method names.

Your Counter class should have the skeleton like so:

class Counter
{
    private int _totalEntrances;
    private int _currentCount;

    public Counter()
    {
        // ... 
    }

    public void Increment()
    {
        // ... 
    }

    public void Decrement()
    {
        // ... 
    }

    public int GetCurrentCount()
    {
        // ... 
    }

    public int GetTotalEntries()
    {
        // ... 
    }

}


I'll leave it up to you to implement those, but it should be pretty straight forward. Now, for your main method:

if (wybor == 'p')
{
    Counter gate2 = new Counter();
    gate2.IncNr(wybor);
    gate.Count(wybor);
}


Here, you're creating a new counter, increment the count, and then throwing away the counter. This doesn't actually do anything. The only work being done here is gate.Count(wybor). Also be aware that a function named Count() changing a value is very confusing. Judging by the name, it should be returning the count, not changing the count. Also, as we already know it's an entrance, so the code should be:

if (wybor == 'p')
{
    gate.Increment();
}


The same applies to the decrement call. 

Currently, your code will exit if the user asks for the count. I'm not sure if this is expected behaviour. I'd expect something like 'q' to quit the program, but 'c' to simply return the count and continue.