-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* @(#)<main.Java.java <project-version> <2024/10/30> | ||
* | ||
* <Task management application> | ||
* | ||
* Built using <IntelliJ> IDE Version: <2023.2.5> | ||
* OpenJDK Runtime Environment <OpenJDK>-<17.0.9> | ||
* | ||
*/ | ||
|
||
// Remaining code | ||
import java.util.Scanner; | ||
|
||
public class Main { | ||
Check warning on line 14 in src/Main.java GitHub Actions / java-linter
|
||
// Definiowanie klasy | ||
public static class Pracownik { | ||
Check warning on line 16 in src/Main.java GitHub Actions / java-linter
Check warning on line 16 in src/Main.java GitHub Actions / java-linter
|
||
// Atrybuty | ||
String imie; | ||
Check warning on line 18 in src/Main.java GitHub Actions / java-linter
|
||
String nazwisko; | ||
Check warning on line 19 in src/Main.java GitHub Actions / java-linter
|
||
String stanowisko; | ||
Check warning on line 20 in src/Main.java GitHub Actions / java-linter
|
||
|
||
// Metoda | ||
void pracuj() { | ||
Check warning on line 23 in src/Main.java GitHub Actions / java-linter
|
||
System.out.println(imie + " " + nazwisko + " pracuje na stanowisku " + stanowisko + "."); | ||
Check warning on line 24 in src/Main.java GitHub Actions / java-linter
Check warning on line 24 in src/Main.java GitHub Actions / java-linter
|
||
} | ||
Check warning on line 25 in src/Main.java GitHub Actions / java-linter
|
||
} | ||
|
||
// Użycie klasy | ||
public static void main(String[] args) { | ||
// Tworzenie obiektów (instancji) klasy Pracownik | ||
Pracownik pracus1 = new Pracownik(); | ||
pracus1.imie = "Jan"; | ||
pracus1.nazwisko = "Kowalski"; | ||
pracus1.stanowisko = "Programista"; | ||
|
||
Pracownik pracus2 = new Pracownik(); | ||
pracus2.imie = "Anna"; | ||
pracus2.nazwisko = "Nowak"; | ||
pracus2.stanowisko = "Tester"; | ||
|
||
// Wywoływanie metody | ||
pracus1.pracuj(); // "Jan Kowalski pracuje na stanowisku Programista." | ||
pracus2.pracuj(); // "Anna Nowak pracuje na stanowisku Tester." | ||
} | ||
} | ||
|