1
0

Add chapters 9-17 for the java book

This commit is contained in:
2025-12-01 14:14:57 +01:00
parent a680b83e47
commit 2da137aea8
54 changed files with 3063 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
public class Coworker {
public String firstName;
public String lastName;
public String number;
public int salary;
public void increase(int percent) {
this.salary += (salary / 100) * percent;
}
}

View File

@@ -0,0 +1,29 @@
import java.io.*;
public class Task {
public static void main(String[] arguments) {
var coworker = new Coworker();
coworker.firstName = "Sebastian";
coworker.lastName = "Mayer";
coworker.number = "1234";
coworker.salary = 3000;
System.out.print("Vorname: ");
System.out.println(coworker.firstName);
System.out.print("Nachname: ");
System.out.println(coworker.lastName);
System.out.print("Personalnummer: ");
System.out.println(coworker.number);
System.out.print("Monatslohn: ");
System.out.println(coworker.salary);
coworker.increase(5);
System.out.print("Monatslohn erhöht um 5%: ");
System.out.println(coworker.salary);
}
}