I wanted to know how to do an algorithm where I entered a year, and the value increased with age, like year 2016 = 1, year 2017 = 2, in a method.
Something like this:
int fazAniversidade(int ano) {
if(ano == 2015) {
this.idade +=1;
}
if(ano == 2016) {
this.idade +=2;
}
return 0;
}
But in a loop, how to do it?