Merge branch 'main' of https://github.com/danielvici/schule-24-25
This commit is contained in:
49
progp/25-2-19/lehrerclass.php
Normal file
49
progp/25-2-19/lehrerclass.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
class Lehrer {
|
||||
//Attribute (Member)
|
||||
private string $vorname;
|
||||
private string $nachname;
|
||||
private int $gehaltsstufe;
|
||||
|
||||
//spezieller (parametrisierter) Konstruktor
|
||||
public function __construct(string $vn, string $nn, int $gs){
|
||||
$this->setVorname($vn);
|
||||
$this->setNachname($nn);
|
||||
$this->setGehaltsstufe($gs);
|
||||
}
|
||||
|
||||
// Öffentliche Methoden
|
||||
// Setter
|
||||
private function setVorname(string $vn):void{
|
||||
$this->vorname = $vn;
|
||||
}
|
||||
|
||||
private function setNachname(string $nn):void{
|
||||
$this->nachname = $nn;
|
||||
}
|
||||
private function setGehaltsstufe(int $gs):void{
|
||||
$this->gehaltsstufe = $gs;
|
||||
}
|
||||
|
||||
// Getter
|
||||
private function getVorname():string{
|
||||
return $this->vorname;
|
||||
}
|
||||
|
||||
private function getNachname():string{
|
||||
return $this->nachname;
|
||||
}
|
||||
private function getGehaltsstufe():int{
|
||||
return $this->gehaltsstufe;
|
||||
}
|
||||
|
||||
public function ausgeben():void{
|
||||
echo "<p>Lehrer: $this->vorname</p><br>";
|
||||
echo "<p>Lehrer: $this->nachname</p><br>";
|
||||
echo "<p>Gehaltsstufe: A$this->gehaltsstufe </p><br>";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
15
progp/25-2-19/lehrerclasses.php
Normal file
15
progp/25-2-19/lehrerclasses.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
require_once "lehrerclass.php";
|
||||
$l = new Lehrer("Michael", " Staudt", 13);
|
||||
$l->ausgeben();
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
40
progp/25-2-26 - class/lehrer-class.php
Normal file
40
progp/25-2-26 - class/lehrer-class.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
class Lehrer extends Person{
|
||||
// Attribute (Member)
|
||||
private int $gehaltsstufe;
|
||||
|
||||
// spezieller (parametrisierter) Konstruktor
|
||||
public function __construct(string $vn, string $nn, int $gs) {
|
||||
parent::__construct($vn, $nn);
|
||||
$this->setGehaltsstufe($gs);
|
||||
}
|
||||
|
||||
// Öffentliche Zugriffsfunktionen
|
||||
// Setter
|
||||
public function setGehaltsstufe(int $gs): void {
|
||||
$this->gehaltsstufe = $gs;
|
||||
}
|
||||
|
||||
// Getter
|
||||
public function getGehaltsstufe(): int {
|
||||
return $this->gehaltsstufe;
|
||||
}
|
||||
|
||||
// Sonstige Funktionen
|
||||
public function ausgabe() {
|
||||
echo "<p>";
|
||||
echo "Vorname: $this->vorname<br>";
|
||||
echo "Nachname: $this->nachname<br>";
|
||||
echo "Gehaltsstufe: A$this->gehaltsstufe";
|
||||
echo "</p>";
|
||||
}
|
||||
|
||||
public function befoerdern():bool{
|
||||
if($this->gehaltsstufe < 16){
|
||||
$this->gehaltsstufe++;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
61
progp/25-2-26 - class/lehrer-test.php
Normal file
61
progp/25-2-26 - class/lehrer-test.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
ini_set("display_errors", "on");
|
||||
require_once "lehrer-class.php";
|
||||
require_once "schueler-class.php";
|
||||
require_once "personen-class.php";
|
||||
|
||||
// --------------------
|
||||
// L E H R E R T E S T
|
||||
// --------------------
|
||||
|
||||
echo "<h2>Lehrer</h2>";
|
||||
$l = new Lehrer("Michael", "Staudt", 13);
|
||||
$l->ausgabe();
|
||||
if($l->befoerdern()){
|
||||
echo "<p>Beförderung erfolgreich!</p>";
|
||||
echo "Neue Stufe: ".$l->getGehaltsstufe()."</p>";
|
||||
}else {
|
||||
echo "<p>Beförderung nicht erfolgreich, da höchste Stufe erreicht</p>";
|
||||
}
|
||||
|
||||
// $l->ausgabe();
|
||||
$l->befoerdern(); // A15
|
||||
$l->befoerdern(); // A16
|
||||
$l->befoerdern(); // A17
|
||||
$l->befoerdern(); // A18
|
||||
|
||||
// A18 -> A19
|
||||
if($l->befoerdern()){
|
||||
echo "<p>Beförderung erfolgreich!</p>";
|
||||
echo "Neue Stufe: ".$l->getGehaltsstufe()."</p>";
|
||||
}else {
|
||||
echo "<p>Beförderung nicht erfolgreich, da höchste Stufe erreicht</p>";
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
// S C H U E L E R T E S T
|
||||
// ------------------------
|
||||
|
||||
echo "<h2>Schüler</h2>";
|
||||
$s = new Schueler("daniel", "vici123", "2BKI1");
|
||||
$s->ausgabe();
|
||||
|
||||
// --------------------
|
||||
// P E R S O N T E S T
|
||||
// --------------------
|
||||
|
||||
echo "<h2>Personen</h2>";
|
||||
$p = new Person("danielvici", "123");
|
||||
$p->ausgabe();
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
42
progp/25-2-26 - class/personen-class.php
Normal file
42
progp/25-2-26 - class/personen-class.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
class Person {
|
||||
// Attribute (Member)
|
||||
private string $vorname;
|
||||
private string $nachname;
|
||||
|
||||
|
||||
// spezieller (parametrisierter) Konstruktor
|
||||
public function __construct(string $vn, string $nn) {
|
||||
$this->setVorname($vn);
|
||||
$this->setNachname($nn);
|
||||
}
|
||||
|
||||
// Öffentliche Zugriffsfunktionen
|
||||
// Setter
|
||||
public function setVorname(string $vn): void {
|
||||
$this->vorname = $vn;
|
||||
}
|
||||
|
||||
public function setNachname(string $nn): void {
|
||||
$this->nachname = $nn;
|
||||
}
|
||||
|
||||
// Getter
|
||||
public function getVorname(): string {
|
||||
return $this->vorname;
|
||||
}
|
||||
|
||||
public function getNachname(): string {
|
||||
return $this->nachname;
|
||||
}
|
||||
|
||||
// Sonstige Funktionen
|
||||
public function ausgabe() {
|
||||
echo "<p>";
|
||||
echo "Vorname: $this->vorname<br>";
|
||||
echo "Nachname: $this->nachname<br>";
|
||||
echo "</p>";
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
59
progp/25-2-26 - class/schueler-class.php
Normal file
59
progp/25-2-26 - class/schueler-class.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
class Schueler {
|
||||
// Attribute (Member)
|
||||
private string $vorname;
|
||||
private string $nachname;
|
||||
private string $klasse;
|
||||
|
||||
// spezieller (parametrisierter) Konstruktor
|
||||
public function __construct(string $vn, string $nn, string $kl) {
|
||||
$this->setVorname($vn);
|
||||
$this->setNachname($nn);
|
||||
$this->setKlasse($kl);
|
||||
}
|
||||
|
||||
// Öffentliche Zugriffsfunktionen
|
||||
// Setter
|
||||
public function setVorname(string $vn): void {
|
||||
$this->vorname = $vn;
|
||||
}
|
||||
|
||||
public function setNachname(string $nn): void {
|
||||
$this->nachname = $nn;
|
||||
}
|
||||
|
||||
public function setKlasse(string $kl): void {
|
||||
$this->klasse = $kl;
|
||||
}
|
||||
|
||||
// Getter
|
||||
public function getVorname(): string {
|
||||
return $this->vorname;
|
||||
}
|
||||
|
||||
public function getNachname(): string {
|
||||
return $this->nachname;
|
||||
}
|
||||
|
||||
public function getKlasse(): string {
|
||||
return $this->klasse;
|
||||
}
|
||||
|
||||
// Sonstige Funktionen
|
||||
public function ausgabe() {
|
||||
echo "<p>";
|
||||
echo "Vorname: $this->vorname<br>";
|
||||
echo "Nachname: $this->nachname<br>";
|
||||
echo "Klasse: $this->klasse";
|
||||
echo "</p>";
|
||||
}
|
||||
|
||||
public function versetzen():bool{
|
||||
if($this->klasse == "2BKI1"){
|
||||
$this->klasse = "2BKI2";
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
17
progp/25-2-27/aufgabe-1.php
Normal file
17
progp/25-2-27/aufgabe-1.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<h1>Moin</h1>
|
||||
|
||||
<?php
|
||||
|
||||
$i = 0;
|
||||
|
||||
while ($i < 10) {
|
||||
if ($i > 5) {
|
||||
echo $i . "<br>";
|
||||
} else {
|
||||
echo $i . "<br>";
|
||||
}
|
||||
$i = $i + 1;
|
||||
}
|
||||
echo $i;
|
||||
|
||||
?>
|
||||
9
progp/25-2-6/buuble-sort.py
Normal file
9
progp/25-2-6/buuble-sort.py
Normal file
@@ -0,0 +1,9 @@
|
||||
arr_test = [4,5,9,1,3]
|
||||
|
||||
for i in range(len(arr_test)):
|
||||
if arr_test[i] > arr_test[i + 1]:
|
||||
temp = arr_test[i]
|
||||
arr_test[i] = arr_test[i + 1]
|
||||
arr_test[i + 1] = temp
|
||||
|
||||
print(arr_test)
|
||||
40
progp/25-3-19/lehrer-class.php
Normal file
40
progp/25-3-19/lehrer-class.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
require_once "personen-class.php";
|
||||
class Lehrer extends Person{
|
||||
// Attribute (Member)
|
||||
private int $gehaltsstufe;
|
||||
|
||||
// spezieller (parametrisierter) Konstruktor
|
||||
public function __construct(string $vn, string $nn, int $gs) {
|
||||
parent::__construct($vn, $nn);
|
||||
$this->setGehaltsstufe($gs);
|
||||
}
|
||||
|
||||
// Öffentliche Zugriffsfunktionen
|
||||
// Setter
|
||||
public function setGehaltsstufe(int $gs): void {
|
||||
$this->gehaltsstufe = $gs;
|
||||
}
|
||||
|
||||
// Getter
|
||||
public function getGehaltsstufe(): int {
|
||||
return $this->gehaltsstufe;
|
||||
}
|
||||
|
||||
// Sonstige Funktionen
|
||||
public function ausgabe() { // Funktion ausgabe() der Elternklasse
|
||||
// überschreibt => erweitern
|
||||
parent::ausgabe();
|
||||
echo "Gehaltsstufe: A$this->gehaltsstufe";
|
||||
echo "</p>";
|
||||
}
|
||||
|
||||
public function befoerdern():bool{
|
||||
if($this->gehaltsstufe < 16){
|
||||
$this->gehaltsstufe++;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
61
progp/25-3-19/lehrer-test.php
Normal file
61
progp/25-3-19/lehrer-test.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
ini_set("display_errors", "on");
|
||||
require_once "lehrer-class.php";
|
||||
require_once "schueler-class.php";
|
||||
require_once "personen-class.php";
|
||||
|
||||
// --------------------
|
||||
// L E H R E R T E S T
|
||||
// --------------------
|
||||
|
||||
echo "<h2>Lehrer</h2>";
|
||||
$l = new Lehrer("Michael", "Staudt", 13);
|
||||
$l->ausgabe();
|
||||
if($l->befoerdern()){
|
||||
echo "<p>Beförderung erfolgreich!</p>";
|
||||
echo "Neue Stufe: ".$l->getGehaltsstufe()."</p>";
|
||||
}else {
|
||||
echo "<p>Beförderung nicht erfolgreich, da höchste Stufe erreicht</p>";
|
||||
}
|
||||
|
||||
// $l->ausgabe();
|
||||
$l->befoerdern(); // A15
|
||||
$l->befoerdern(); // A16
|
||||
$l->befoerdern(); // A17
|
||||
$l->befoerdern(); // A18
|
||||
|
||||
// A18 -> A19
|
||||
if($l->befoerdern()){
|
||||
echo "<p>Beförderung erfolgreich!</p>";
|
||||
echo "Neue Stufe: ".$l->getGehaltsstufe()."</p>";
|
||||
}else {
|
||||
echo "<p>Beförderung nicht erfolgreich, da höchste Stufe erreicht</p>";
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
// S C H U E L E R T E S T
|
||||
// ------------------------
|
||||
|
||||
echo "<h2>Schüler</h2>";
|
||||
$s = new Schueler("daniel", "vici123", "2BKI1");
|
||||
$s->ausgabe();
|
||||
|
||||
// --------------------
|
||||
// P E R S O N T E S T
|
||||
// --------------------
|
||||
|
||||
echo "<h2>Personen</h2>";
|
||||
$p = new Person("danielvici", "123");
|
||||
$p->ausgabe();
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
5
progp/25-3-19/person-test.php
Normal file
5
progp/25-3-19/person-test.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
// Hab nicht mit geschrieben...
|
||||
|
||||
?>
|
||||
42
progp/25-3-19/personen-class.php
Normal file
42
progp/25-3-19/personen-class.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
class Person { // dient nur zur vererberung, kein objekt erzeugen
|
||||
// Attribute (Member)
|
||||
private string $vorname; // # protected, + public, - private
|
||||
private string $nachname; // #
|
||||
|
||||
|
||||
// spezieller (parametrisierter) Konstruktor
|
||||
public function __construct(string $vn, string $nn) {
|
||||
$this->setVorname($vn);
|
||||
$this->setNachname($nn);
|
||||
}
|
||||
|
||||
// Öffentliche Zugriffsfunktionen
|
||||
// Setter
|
||||
public function setVorname(string $vn): void {
|
||||
$this->vorname = $vn;
|
||||
}
|
||||
|
||||
public function setNachname(string $nn): void {
|
||||
$this->nachname = $nn;
|
||||
}
|
||||
|
||||
// Getter
|
||||
public function getVorname(): string {
|
||||
return $this->vorname;
|
||||
}
|
||||
|
||||
public function getNachname(): string {
|
||||
return $this->nachname;
|
||||
}
|
||||
|
||||
// Sonstige Funktionen
|
||||
public function ausgabe() {
|
||||
echo "<p>";
|
||||
echo "Vorname: $this->vorname<br>";
|
||||
echo "Nachname: $this->nachname<br>";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
39
progp/25-3-19/schueler-class.php
Normal file
39
progp/25-3-19/schueler-class.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
require_once "personen-class.php";
|
||||
class Schueler extends Person{
|
||||
// Attribute (Member)
|
||||
private string $klasse;
|
||||
|
||||
// spezieller (parametrisierter) Konstruktor
|
||||
public function __construct(string $vn, string $nn, string $kl) {
|
||||
parent::__construct($vn, $nn);
|
||||
$this->setKlasse($kl);
|
||||
}
|
||||
|
||||
// Öffentliche Zugriffsfunktionen
|
||||
// Setter
|
||||
public function setKlasse(string $kl): void {
|
||||
$this->klasse = $kl;
|
||||
}
|
||||
|
||||
// Getter
|
||||
public function getKlasse(): string {
|
||||
return $this->klasse;
|
||||
}
|
||||
|
||||
// Sonstige Funktionen
|
||||
public function ausgabe() {
|
||||
parent::ausgabe();
|
||||
echo "Klasse: $this->klasse";
|
||||
echo "</p>";
|
||||
}
|
||||
|
||||
public function versetzen():bool{
|
||||
if($this->klasse == "2BKI1"){
|
||||
$this->klasse = "2BKI2";
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
45
progp/25-3-26/lehrer-class.php
Normal file
45
progp/25-3-26/lehrer-class.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
require_once "personen-class.php";
|
||||
class Lehrer extends Person{
|
||||
// Attribute (Member)
|
||||
private int $gehaltsstufe;#
|
||||
|
||||
// Klassen Arttribute
|
||||
public static int $maxGehaltsstufe =16;
|
||||
|
||||
// spezieller (parametrisierter) Konstruktor
|
||||
public function __construct(string $vn, string $nn, int $gs) {
|
||||
parent::__construct($vn, $nn);
|
||||
$this->setGehaltsstufe($gs);
|
||||
}
|
||||
|
||||
// Öffentliche Zugriffsfunktionen
|
||||
// Setter
|
||||
public function setGehaltsstufe(int $gs): void {
|
||||
$this->gehaltsstufe = $gs;
|
||||
}
|
||||
|
||||
// Getter
|
||||
public function getGehaltsstufe(): int {
|
||||
return $this->gehaltsstufe;
|
||||
}
|
||||
|
||||
// Sonstige Funktionen
|
||||
public function ausgabe() { // Funktion ausgabe() der Elternklasse
|
||||
// überschreibt => erweitern
|
||||
parent::ausgabe();
|
||||
echo "Gehaltsstufe: A$this->gehaltsstufe";
|
||||
echo "</p>";
|
||||
}
|
||||
|
||||
public function befoerdern():bool{
|
||||
// self die klasse selsbst -> Klasse lehrer
|
||||
// $this-> die Instanz der Klasse
|
||||
if($this->gehaltsstufe < self::$maxGehaltsstufe){
|
||||
$this->gehaltsstufe++;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
50
progp/25-3-26/lehrer-test.php
Normal file
50
progp/25-3-26/lehrer-test.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
ini_set("display_errors", "on");
|
||||
require_once "lehrer-class.php";
|
||||
require_once "schueler-class.php";
|
||||
require_once "personen-class.php";
|
||||
|
||||
// --------------------
|
||||
// L E H R E R T E S T
|
||||
// --------------------
|
||||
|
||||
echo "<h2>Lehrer</h2>";
|
||||
$l = new Lehrer("Michael", "Staudt", 13);
|
||||
$l->ausgabe();
|
||||
if($l->befoerdern()){
|
||||
echo "<p>Beförderung erfolgreich!</p>";
|
||||
echo "Neue Stufe: ".$l->getGehaltsstufe()."</p>";
|
||||
}else {
|
||||
echo "<p>Beförderung nicht erfolgreich, da höchste Stufe erreicht</p>";
|
||||
}
|
||||
|
||||
|
||||
// ------------------------
|
||||
// S C H U E L E R T E S T
|
||||
// ------------------------
|
||||
|
||||
echo "<h2>Schüler</h2>";
|
||||
$s = new Schueler("daniel", "vici123", "2BKI1");
|
||||
$s->ausgabe();
|
||||
|
||||
// --------------------
|
||||
// P E R S O N T E S T
|
||||
// --------------------
|
||||
|
||||
echo "<h2>Personen</h2>";
|
||||
$p = new Person("danielvici", "123");
|
||||
$p->ausgabe();
|
||||
|
||||
?>
|
||||
<br>
|
||||
<p>Über mir sollte php code ausgeführt werden</p>
|
||||
</body>
|
||||
</html>
|
||||
5
progp/25-3-26/person-test.php
Normal file
5
progp/25-3-26/person-test.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
// Hab nicht mit geschrieben...
|
||||
|
||||
?>
|
||||
42
progp/25-3-26/personen-class.php
Normal file
42
progp/25-3-26/personen-class.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
class Person { // dient nur zur vererberung, kein objekt erzeugen
|
||||
// Attribute (Member)
|
||||
private string $vorname; // # protected, + public, - private
|
||||
private string $nachname; // #
|
||||
|
||||
|
||||
// spezieller (parametrisierter) Konstruktor
|
||||
public function __construct(string $vn, string $nn) {
|
||||
$this->setVorname($vn);
|
||||
$this->setNachname($nn);
|
||||
}
|
||||
|
||||
// Öffentliche Zugriffsfunktionen
|
||||
// Setter
|
||||
public function setVorname(string $vn): void {
|
||||
$this->vorname = $vn;
|
||||
}
|
||||
|
||||
public function setNachname(string $nn): void {
|
||||
$this->nachname = $nn;
|
||||
}
|
||||
|
||||
// Getter
|
||||
public function getVorname(): string {
|
||||
return $this->vorname;
|
||||
}
|
||||
|
||||
public function getNachname(): string {
|
||||
return $this->nachname;
|
||||
}
|
||||
|
||||
// Sonstige Funktionen
|
||||
public function ausgabe() {
|
||||
echo "<p>";
|
||||
echo "Vorname: $this->vorname<br>";
|
||||
echo "Nachname: $this->nachname<br>";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
39
progp/25-3-26/schueler-class.php
Normal file
39
progp/25-3-26/schueler-class.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
require_once "personen-class.php";
|
||||
class Schueler extends Person{
|
||||
// Attribute (Member)
|
||||
private string $klasse;
|
||||
|
||||
// spezieller (parametrisierter) Konstruktor
|
||||
public function __construct(string $vn, string $nn, string $kl) {
|
||||
parent::__construct($vn, $nn);
|
||||
$this->setKlasse($kl);
|
||||
}
|
||||
|
||||
// Öffentliche Zugriffsfunktionen
|
||||
// Setter
|
||||
public function setKlasse(string $kl): void {
|
||||
$this->klasse = $kl;
|
||||
}
|
||||
|
||||
// Getter
|
||||
public function getKlasse(): string {
|
||||
return $this->klasse;
|
||||
}
|
||||
|
||||
// Sonstige Funktionen
|
||||
public function ausgabe() {
|
||||
parent::ausgabe();
|
||||
echo "Klasse: $this->klasse";
|
||||
echo "</p>";
|
||||
}
|
||||
|
||||
public function versetzen():bool{
|
||||
if($this->klasse == "2BKI1"){
|
||||
$this->klasse = "2BKI2";
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
68
progp/25-4-2 - oop/a2_klassen.php
Normal file
68
progp/25-4-2 - oop/a2_klassen.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
ini_set("display_errors", "on");
|
||||
class mitarbeiter {
|
||||
public string $name;
|
||||
public string $geburtsdatum;
|
||||
public int $gehalt;
|
||||
|
||||
public function __construct(string $n, string $gb, int $g) {
|
||||
$this->name = $n;
|
||||
$this->geburtsdatum = $gb;
|
||||
$this->gehalt = $g;
|
||||
}
|
||||
|
||||
public function getInfo():void {
|
||||
echo "Name: $this->name <br>";
|
||||
echo "Geburtsdatum: $this->geburtsdatum <br>";
|
||||
echo" Gehalt: $this->gehalt <br>";
|
||||
}
|
||||
public function getJahresgehalt():int {
|
||||
return $this->gehalt * 12;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class vollzeit extends mitarbeiter {
|
||||
public int $arbeitszeit = 40;
|
||||
public int $bonus;
|
||||
|
||||
public function __construct(string $n, string $gb, int $g, int $b) {
|
||||
parent::__construct($n, $gb, $g);
|
||||
$this->arbeitszeit = 40;
|
||||
$this->bonus = $b;
|
||||
}
|
||||
|
||||
public function getInfo(): void {
|
||||
parent::getInfo();
|
||||
echo "Arbeitszeit: $this->arbeitszeit <br>";
|
||||
echo "Bonus: $this->bonus <br>";
|
||||
}
|
||||
|
||||
public function getJahresgehalt():int {
|
||||
return parent::getJahresgehalt() + $this->bonus;
|
||||
}
|
||||
}
|
||||
|
||||
class teilzeit extends mitarbeiter {
|
||||
public string $arbeitszeit; // h pro woche
|
||||
public int $stundenlohn = 15; // Euro pro Stunde
|
||||
public int $gehalt = 0;
|
||||
|
||||
public function __construct(string $n, string $gb, int $g, int $hpw, int $sl) {
|
||||
parent::__construct($n, $gb, $g);
|
||||
$this->arbeitszeit = $hpw;
|
||||
$this->gehalt = $this->gehalt + ($hpw * $sl * 4); // 4 Wochen pro Monat
|
||||
$this->stundenlohn = $sl;
|
||||
}
|
||||
|
||||
public function getInfo(): void {
|
||||
parent::getInfo();
|
||||
echo "Arbeitszeit: $this->arbeitszeit <br>";
|
||||
echo "Stundenlohn: $this->stundenlohn <br>";
|
||||
}
|
||||
|
||||
public function getJahresgehalt():int {
|
||||
return parent::getJahresgehalt() + ($this->stundenlohn * 20 * 12);
|
||||
}
|
||||
}
|
||||
?>
|
||||
25
progp/25-4-2 - oop/a2_test.php
Normal file
25
progp/25-4-2 - oop/a2_test.php
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Teilnehmer</h1>
|
||||
<?php
|
||||
ini_set("display_errors", "on");
|
||||
require_once 'a2_klassen.php';
|
||||
echo "<h2>Daniel</h2>";
|
||||
$vz = new vollzeit("Daniel", "2000-01-01", 3000, 1000);
|
||||
$vz->getInfo();
|
||||
echo "<br>";
|
||||
echo "<h2>Aurelion Sol</h2>";
|
||||
$tz = new teilzeit("Aurelion Sol", "2000-01-01", 3000, 20, 15);
|
||||
$tz->getInfo();
|
||||
?>
|
||||
<br>
|
||||
<p>Über mir sollte php code ausgeführt werden</p>
|
||||
</body>
|
||||
</html>
|
||||
14
progp/25-4-2 - oop/teilnehmer.php
Normal file
14
progp/25-4-2 - oop/teilnehmer.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
ini_set("display_errors", "on");
|
||||
class teilnehmer {
|
||||
public string $name;
|
||||
public string $vorname;
|
||||
public string $code;
|
||||
|
||||
public function __construct(string $n, string $vn, string $c) {
|
||||
$this->name = $n;
|
||||
$this->vorname = $vn;
|
||||
$this->code = $c;
|
||||
}
|
||||
}
|
||||
?>
|
||||
26
progp/25-4-2 - oop/testteilnehmer.php
Normal file
26
progp/25-4-2 - oop/testteilnehmer.php
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Teilnehmer</h1>
|
||||
<?php
|
||||
ini_set("display_errors", "on");
|
||||
require_once 'teilnehmer.php';
|
||||
require_once 'tnintern.php';
|
||||
echo "<h2>Daniel</h2>";
|
||||
$tl = new tnintern("vici123", "daniel", "2BKI1", "IT");
|
||||
$tl->getDaten();
|
||||
echo "<br>";
|
||||
echo "<h2>Aurelion Sol</h2>";
|
||||
$tl = new tnintern("sol", "aurelion", "mage", "midde");
|
||||
$tl->getDaten();
|
||||
?>
|
||||
<br>
|
||||
<p>Über mir sollte php code ausgeführt werden</p>
|
||||
</body>
|
||||
</html>
|
||||
26
progp/25-4-2 - oop/tnintern.php
Normal file
26
progp/25-4-2 - oop/tnintern.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
require_once 'teilnehmer.php';
|
||||
ini_set("display_errors", "on");
|
||||
class tnintern extends teilnehmer {
|
||||
private string $abteilung;
|
||||
private int $anzahl=0;
|
||||
|
||||
public function __construct($n, $vn, $c ,$abteilung) {
|
||||
parent::__construct($vn, $n, $c);
|
||||
$this->abteilung = $abteilung;
|
||||
$this->anzahl= $this->anzahl+1;
|
||||
}
|
||||
|
||||
public function getDaten() {
|
||||
echo "Name: $this->name <br>";
|
||||
echo "Vorname: $this->vorname <br>";
|
||||
echo "Code: $this->code <br>";
|
||||
echo "Abteilung: $this->abteilung <br>";
|
||||
echo "Anzahl: $this->anzahl";
|
||||
}
|
||||
|
||||
public function getAnzahl():int {
|
||||
return $this->anzahl;
|
||||
}
|
||||
}
|
||||
?>
|
||||
40
progp/oop-vorlage/lehrer-class.php
Normal file
40
progp/oop-vorlage/lehrer-class.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
class Lehrer extends Person{
|
||||
// Attribute (Member)
|
||||
private int $gehaltsstufe;
|
||||
|
||||
// spezieller (parametrisierter) Konstruktor
|
||||
public function __construct(string $vn, string $nn, int $gs) {
|
||||
parent::__construct($vn, $nn);
|
||||
$this->setGehaltsstufe($gs);
|
||||
}
|
||||
|
||||
// Öffentliche Zugriffsfunktionen
|
||||
// Setter
|
||||
public function setGehaltsstufe(int $gs): void {
|
||||
$this->gehaltsstufe = $gs;
|
||||
}
|
||||
|
||||
// Getter
|
||||
public function getGehaltsstufe(): int {
|
||||
return $this->gehaltsstufe;
|
||||
}
|
||||
|
||||
// Sonstige Funktionen
|
||||
public function ausgabe() {
|
||||
echo "<p>";
|
||||
echo "Vorname: $this->vorname<br>";
|
||||
echo "Nachname: $this->nachname<br>";
|
||||
echo "Gehaltsstufe: A$this->gehaltsstufe";
|
||||
echo "</p>";
|
||||
}
|
||||
|
||||
public function befoerdern():bool{
|
||||
if($this->gehaltsstufe < 16){
|
||||
$this->gehaltsstufe++;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
61
progp/oop-vorlage/lehrer-test.php
Normal file
61
progp/oop-vorlage/lehrer-test.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
ini_set("display_errors", "on");
|
||||
require_once "lehrer-class.php";
|
||||
require_once "schueler-class.php";
|
||||
require_once "personen-class.php";
|
||||
|
||||
// --------------------
|
||||
// L E H R E R T E S T
|
||||
// --------------------
|
||||
|
||||
echo "<h2>Lehrer</h2>";
|
||||
$l = new Lehrer("Michael", "Staudt", 13);
|
||||
$l->ausgabe();
|
||||
if($l->befoerdern()){
|
||||
echo "<p>Beförderung erfolgreich!</p>";
|
||||
echo "Neue Stufe: ".$l->getGehaltsstufe()."</p>";
|
||||
}else {
|
||||
echo "<p>Beförderung nicht erfolgreich, da höchste Stufe erreicht</p>";
|
||||
}
|
||||
|
||||
// $l->ausgabe();
|
||||
$l->befoerdern(); // A15
|
||||
$l->befoerdern(); // A16
|
||||
$l->befoerdern(); // A17
|
||||
$l->befoerdern(); // A18
|
||||
|
||||
// A18 -> A19
|
||||
if($l->befoerdern()){
|
||||
echo "<p>Beförderung erfolgreich!</p>";
|
||||
echo "Neue Stufe: ".$l->getGehaltsstufe()."</p>";
|
||||
}else {
|
||||
echo "<p>Beförderung nicht erfolgreich, da höchste Stufe erreicht</p>";
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
// S C H U E L E R T E S T
|
||||
// ------------------------
|
||||
|
||||
echo "<h2>Schüler</h2>";
|
||||
$s = new Schueler("daniel", "vici123", "2BKI1");
|
||||
$s->ausgabe();
|
||||
|
||||
// --------------------
|
||||
// P E R S O N T E S T
|
||||
// --------------------
|
||||
|
||||
echo "<h2>Personen</h2>";
|
||||
$p = new Person("danielvici", "123");
|
||||
$p->ausgabe();
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
42
progp/oop-vorlage/personen-class.php
Normal file
42
progp/oop-vorlage/personen-class.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
class Person {
|
||||
// Attribute (Member)
|
||||
private string $vorname;
|
||||
private string $nachname;
|
||||
|
||||
|
||||
// spezieller (parametrisierter) Konstruktor
|
||||
public function __construct(string $vn, string $nn) {
|
||||
$this->setVorname($vn);
|
||||
$this->setNachname($nn);
|
||||
}
|
||||
|
||||
// Öffentliche Zugriffsfunktionen
|
||||
// Setter
|
||||
public function setVorname(string $vn): void {
|
||||
$this->vorname = $vn;
|
||||
}
|
||||
|
||||
public function setNachname(string $nn): void {
|
||||
$this->nachname = $nn;
|
||||
}
|
||||
|
||||
// Getter
|
||||
public function getVorname(): string {
|
||||
return $this->vorname;
|
||||
}
|
||||
|
||||
public function getNachname(): string {
|
||||
return $this->nachname;
|
||||
}
|
||||
|
||||
// Sonstige Funktionen
|
||||
public function ausgabe() {
|
||||
echo "<p>";
|
||||
echo "Vorname: $this->vorname<br>";
|
||||
echo "Nachname: $this->nachname<br>";
|
||||
echo "</p>";
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
59
progp/oop-vorlage/schueler-class.php
Normal file
59
progp/oop-vorlage/schueler-class.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
class Schueler {
|
||||
// Attribute (Member)
|
||||
private string $vorname;
|
||||
private string $nachname;
|
||||
private string $klasse;
|
||||
|
||||
// spezieller (parametrisierter) Konstruktor
|
||||
public function __construct(string $vn, string $nn, string $kl) {
|
||||
$this->setVorname($vn);
|
||||
$this->setNachname($nn);
|
||||
$this->setKlasse($kl);
|
||||
}
|
||||
|
||||
// Öffentliche Zugriffsfunktionen
|
||||
// Setter
|
||||
public function setVorname(string $vn): void {
|
||||
$this->vorname = $vn;
|
||||
}
|
||||
|
||||
public function setNachname(string $nn): void {
|
||||
$this->nachname = $nn;
|
||||
}
|
||||
|
||||
public function setKlasse(string $kl): void {
|
||||
$this->klasse = $kl;
|
||||
}
|
||||
|
||||
// Getter
|
||||
public function getVorname(): string {
|
||||
return $this->vorname;
|
||||
}
|
||||
|
||||
public function getNachname(): string {
|
||||
return $this->nachname;
|
||||
}
|
||||
|
||||
public function getKlasse(): string {
|
||||
return $this->klasse;
|
||||
}
|
||||
|
||||
// Sonstige Funktionen
|
||||
public function ausgabe() {
|
||||
echo "<p>";
|
||||
echo "Vorname: $this->vorname<br>";
|
||||
echo "Nachname: $this->nachname<br>";
|
||||
echo "Klasse: $this->klasse";
|
||||
echo "</p>";
|
||||
}
|
||||
|
||||
public function versetzen():bool{
|
||||
if($this->klasse == "2BKI1"){
|
||||
$this->klasse = "2BKI2";
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
16
progp/sonstiges/aufgabe-4.php
Normal file
16
progp/sonstiges/aufgabe-4.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
$n = 7;
|
||||
$k = -2;
|
||||
$i = 0;
|
||||
while ($n != 1 && $i < 3){
|
||||
$i++;
|
||||
if ($n % 2 == 0) {
|
||||
$n = ($n/2);
|
||||
echo $n ;
|
||||
} else {
|
||||
$n = ((2 $k) + 1) $n + 1;
|
||||
$k--;
|
||||
echo $n ;
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user