Witam. Stworzyłem klasę pracownik i metode, ktora bedzie zmieniac jego pensje. Jednak po utworzeniu obiektu, a nst wywolaniu metody pensja pozostaje bez zmian. Prosze o pomoc :)
class pracownik
{
private String name;
private String surname;
private int salary;
pracownik(String n,String s, int pensja)
{
this.name = n;
this.surname = s;
this.salary = pensja;
}
void podwyzka(int procent)
{
salary = salary + salary*(procent/100);
}
void wyswietlanie()
{
System.out.println("Imie: "+ this.name +" Nazwisko: "+this.surname+ " pensja: "+
this.salary);
}
}
public class Main {
public static void main(String [] args)
{
pracownik a = new pracownik("Adam","Kowalski",9000);
a.wyswietlanie();
System.out.println();
a.podwyzka(50);
a.wyswietlanie();
}
}