How can I get an employee's vacation period C #

-3

You see, how could I do this in code, I've been spinning again and again but I can not think of how to implement it with code c #.

An employee who has been in the company for 1 year of work has 6 days of vacation, another that has been working for 2 years, 8 days and as one year goes by, the days for holidays are also increasing by 2 days. in 2 and so on.

The problem is that they ask me to print the holiday period.

Example.

An employee came to work in the company on January 1, 2015, currently would be 4 years old, so that their days by right to vacation would be in total 12.

The problem is that if an employee has never taken vacations since he entered, they must be taken from the first period he can do so.

Juanito has 12 days of vacations now and only wants to take 8, so he would have to take 6 days of his first period that would be 2016-2017, starts from 2016 because if he entered in 2015, by 2016 he would have been 1 year old and consequently 6 days of vacation by right. But it so happens that Juanito took 8 days not only 6, so he would have to take those two days that are missing from his second period, that is, his second year of seniority, which is 2017 and he has 8 days.

So what should be shown on the screen as a holiday period would be 2016-2017, because it took days of its first period and its second period to compensate the two that were missing, therefore in its first period of 2016, it already has 0 days because I already take all of them, and from the second period of 2017 there are 6 left, because of the 8 that I had, I take two to compensate.

The joke is to go taking days from the oldest periods to go consuming them all and there are no outstanding days from previous periods, I hope you have given me to understand, I really need help.

    
asked by Lupita Martínez Sambrano 05.01.2019 в 00:24
source

0 answers