Voll Upload SGD Fachinformatiker PHP
This commit is contained in:
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
class Autoklasse {
|
||||
|
||||
// Ein Attribute
|
||||
|
||||
private $geschwindigkeit = 0;
|
||||
|
||||
// Der Konstruktor
|
||||
|
||||
public function __construct($standart = 0)
|
||||
{
|
||||
$this->geschwindigkeit = $standart;
|
||||
echo "Ein Objekt wurde erzeugt. <br>";
|
||||
}
|
||||
|
||||
// zum Bremsen:
|
||||
|
||||
public function bremsen($aenderung)
|
||||
{
|
||||
if ($this->geschwindigkeit - $aenderung < 0)
|
||||
{
|
||||
$this->geschwindigkeit = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->geschwindigkeit = $this->geschwindigkeit - $aenderung;
|
||||
}
|
||||
}
|
||||
|
||||
// Zum Gasgeben
|
||||
|
||||
public function gasgeben($aenderung)
|
||||
{
|
||||
$this->geschwindigkeit = $this->geschwindigkeit + $aenderung;
|
||||
}
|
||||
|
||||
//zur Ausgeben der Geschwindigkeit
|
||||
|
||||
public function ausgeben()
|
||||
{
|
||||
echo "Die geschwindigkeit beträgt: " .$this->geschwindigkeit ." .";
|
||||
}
|
||||
|
||||
public function getGeschwindigkeit()
|
||||
{
|
||||
return $this->geschwindigkeit;
|
||||
}
|
||||
|
||||
public function setGeschwindigkeit($neuerWert)
|
||||
{
|
||||
$this->geschwindigkeit = $neuerWert;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
// Instanz erzeugen
|
||||
|
||||
$auto1 = new Autoklasse(0);
|
||||
|
||||
$auto2 = new Autoklasse(10);
|
||||
|
||||
$auto3 = new Autoklasse(0);
|
||||
|
||||
unset($auto3);
|
||||
|
||||
echo "<hr>";
|
||||
|
||||
//die Geschwindigkeit ausgeben
|
||||
echo "Nach dem Erzeugen und initialisieren: ";
|
||||
|
||||
$auto1->ausgabe();
|
||||
$auto2->ausgabe();
|
||||
echo "hr";
|
||||
|
||||
echo "Nach dem Gasgeben: ";
|
||||
|
||||
$auto1->ausgabe();
|
||||
$auto2->ausgabe();
|
||||
|
||||
//Methode Gasgeben aufrufen:
|
||||
|
||||
$auto1->gasgeben(20);
|
||||
$auto2->gasgeben(100);
|
||||
echo "<hr>";
|
||||
|
||||
//Methode Bremsen aufrufen:
|
||||
|
||||
$auto1->bremsen(10);
|
||||
$auto2->bremsen(50);
|
||||
echo "<hr>";
|
||||
*/
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||
<title>Einsendeaufgabe 1 Klassendiagramm umsetzen</title>
|
||||
<?php
|
||||
include_once("Klassendiagramm.php");
|
||||
?>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
var_dump($person = new Person("Fischer", "Fritz"));
|
||||
|
||||
var_dump($mitarbeiter = new Mitarbeiter("Schulze","Maria"));
|
||||
|
||||
var_dump($kunde = new Kunde("Fähnrich", "Timon"));
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
class Person
|
||||
{
|
||||
protected string $name;
|
||||
protected string $vorname;
|
||||
|
||||
|
||||
public function __construct(string $nname, string $vname)
|
||||
{
|
||||
$this->name = $nname;
|
||||
$this->vorname = $vname;
|
||||
}
|
||||
|
||||
public function setName(string $nname):void
|
||||
{
|
||||
$this->name = $nname;
|
||||
}
|
||||
|
||||
public function getName():string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setVorname(string $vname):void
|
||||
{
|
||||
$this->vorname = $vname;
|
||||
}
|
||||
|
||||
public function getVorname():string
|
||||
{
|
||||
return $this->vorname;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
class Mitarbeiter extends Person
|
||||
{
|
||||
private int $gruppierung = 0;
|
||||
private int $steuerklasse = 0;
|
||||
private string $kontonummer = "0";
|
||||
|
||||
}
|
||||
|
||||
|
||||
class Kunde extends Person
|
||||
{
|
||||
private int $bonitaet = 0;
|
||||
|
||||
public function setBonitaet(int $boni): void
|
||||
{
|
||||
$this->bonitaet = $boni;
|
||||
}
|
||||
|
||||
public function getBonitaet():int
|
||||
{
|
||||
return $this->bonitaet;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
class Konto
|
||||
{
|
||||
private int $kontonummer;
|
||||
private float $kontostand;
|
||||
private string $inhaber;
|
||||
|
||||
public function __construct($kn = 000000, $ks = 000.00, $ki = "max, Mustermann")
|
||||
{
|
||||
$this->kontonummer = $kn;
|
||||
$this->kontostand = $ks;
|
||||
$this->inhaber = $ki;
|
||||
|
||||
echo "<p>Konto: " .$this->kontonummer ." wurde erfolgreich angelegt</p>";
|
||||
echo "<p>Kontoinhaber: " .$this->inhaber ."</p>";
|
||||
echo "<p>Kontostand: " .$this->kontostand ." Euro</p>";
|
||||
echo "<hr><br><hr>";
|
||||
}
|
||||
|
||||
public function einzahlung(float $wert)
|
||||
{
|
||||
$this->kontostand = $this->kontostand + $wert;
|
||||
|
||||
echo "<p>Der Betrag " .$wert ."€ wurde auf das Konto mit der Kontonummer " .$this->kontonummer ." eingezahlt. <br>";
|
||||
echo "Neuer Kontostand beträgt: " .$this->kontostand ."€</p>";
|
||||
echo "<hr><hr>";
|
||||
}
|
||||
|
||||
public function abheben(float $wert)
|
||||
{
|
||||
if ($this->kontostand - $wert >= 0)
|
||||
{
|
||||
$this->kontostand = $this->kontostand - $wert;
|
||||
echo "<p>Der Betrag " .$wert ."€ wurde vom Konto mit der Kontonummer " .$this->kontonummer ." ausgezahlt. <br>";
|
||||
echo "Neuer Kontostand beträgt: " .$this->kontostand ."€</p>";
|
||||
echo "<hr><hr>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<p>Nicht genug Guthaben zum Auszahlen auf dem Konto " .$this->kontonummer ."</p>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||
<title>Konto</title>
|
||||
<?php
|
||||
include_once("konto.class.php");
|
||||
?>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
$mayer = new Konto(123, 1000, "Meier, Hans");
|
||||
|
||||
$mayer->einzahlung(500.50);
|
||||
|
||||
$schulze = new Konto(789, 12300.5, "Schulze, Claudia");
|
||||
|
||||
$schulze->einzahlung(20.50);
|
||||
|
||||
$mayer->abheben(50.75);
|
||||
|
||||
$schulze->abheben(20000);
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
include_once("Klassendiagramm.php");
|
||||
|
||||
class Mitarbeiter2 extends Person
|
||||
{
|
||||
|
||||
|
||||
private int $gruppierung = 0;
|
||||
private int $steuerklasse = 0;
|
||||
private string $kontonummer = "0";
|
||||
|
||||
|
||||
public function setSteuerklasse(int $sk)
|
||||
{
|
||||
$this->steuerklasse = $sk;
|
||||
}
|
||||
|
||||
public function getSteuerklasse()
|
||||
{
|
||||
return $this->steuerklasse;
|
||||
}
|
||||
|
||||
public function setGruppierung(int $sg)
|
||||
{
|
||||
$this->gruppierung = $sg;
|
||||
}
|
||||
|
||||
public function getGruppierung()
|
||||
{
|
||||
return $this->gruppierung;
|
||||
}
|
||||
|
||||
public function setKontonummer(string $kn)
|
||||
{
|
||||
$this->kontonummer = $kn;
|
||||
}
|
||||
|
||||
public function getKontonummer()
|
||||
{
|
||||
return $this->kontonummer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$test = new Mitarbeiter2("Meier", "Hännschen");
|
||||
|
||||
|
||||
$test->setSteuerklasse(3);
|
||||
|
||||
$test->setKontonummer("DE489654655465450012");
|
||||
|
||||
$test->setGruppierung(10);
|
||||
|
||||
|
||||
echo "<p>Der Mitarbeiter Hänschen Meier hat die Kontonummer " .$test->getKontonummer()
|
||||
.". Die Steuerklasse ist " .$test->getSteuerklasse()
|
||||
." und die Gruppierung " .$test->getGruppierung() .". </p>\t\n";
|
||||
|
||||
|
||||
var_dump($test);
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
class Autoklasse {
|
||||
//ein Attribut (geschwindigkeit), eine Eigenschaft (0)
|
||||
private $geschwindigkeit = 0;
|
||||
|
||||
//die Methoden zum Initialisieren
|
||||
public function initialisierung($standard) {
|
||||
$this->geschwindigkeit = $standard;
|
||||
}
|
||||
|
||||
//Zum Bremsen:
|
||||
|
||||
public function bremsen($aenderung) {
|
||||
if($this->geschwindigkeit - $aenderung < 0){
|
||||
$this->geschwindigkeit = 0;
|
||||
}
|
||||
else {
|
||||
$this->geschwindigkeit = $this->geschwindigkeit - $aenderung;
|
||||
}
|
||||
}
|
||||
|
||||
//Zum Gasgeben
|
||||
|
||||
public function gasgeben($aenderung){
|
||||
$this->geschwindigkeit = $this->geschwindigkeit + $aenderung;
|
||||
}
|
||||
|
||||
//Ausgabe der Geschwindigkeit
|
||||
public function ausgabe() {
|
||||
echo "Die aktuelle Geschwindigkeit beträgt " .$this->geschwindigkeit .": ";
|
||||
}
|
||||
}
|
||||
|
||||
$auto1 = new Autoklasse();
|
||||
$auto2 = new Autoklasse();
|
||||
|
||||
//Initialisieren für beide Autos:
|
||||
|
||||
$auto1->initialisierung(0);
|
||||
$auto2->initialisierung(10);
|
||||
|
||||
echo "<hr>";
|
||||
//Die Geschwindigkeit ausgeben:
|
||||
|
||||
echo "nach der Initialisierung: ";
|
||||
$auto1->ausgabe();
|
||||
$auto2->ausgabe();
|
||||
echo "<hr>";
|
||||
|
||||
// Methode Gasgeben aufrufen:
|
||||
|
||||
$auto1->gasgeben(20);
|
||||
$auto2->gasgeben(100);
|
||||
echo "<hr>";
|
||||
echo "Nach dem Gasgeben: ";
|
||||
|
||||
$auto1->ausgabe();
|
||||
$auto2->ausgabe();
|
||||
echo "<hr>";
|
||||
|
||||
//Methode Bremsen:
|
||||
|
||||
$auto1->bremsen(10);
|
||||
$auto2->bremsen(50);
|
||||
|
||||
echo "Nach dem Bremsen: ";
|
||||
|
||||
$auto1->ausgabe();
|
||||
$auto2->ausgabe();
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,48 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||
<title>Vererbung</title>
|
||||
<?php
|
||||
include_once("3_2_autoklasse.php")
|
||||
?>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
class Sportwagen extends Autoklasse
|
||||
{
|
||||
private $hoechstgeschwindigkeit = 0;
|
||||
private $geschwindigkeitsBegrenzer = true;
|
||||
private $carboneBremse = true;
|
||||
|
||||
public function __construct($aktuellegeschwindigkeit, $vmax, $begrenzer, $cBremse)
|
||||
{
|
||||
parent::__construct($aktuellegeschwindigkeit);
|
||||
$this->hoechstgeschwindigkeit = $vmax
|
||||
}
|
||||
|
||||
public function setHoechstgeschwindigkeit($wert)
|
||||
{
|
||||
$this->hoechstgeschwindigkeit = $wert;
|
||||
}
|
||||
|
||||
public function getHoechstgeschwindigkeit()
|
||||
{
|
||||
return $this->hoechstgeschwindigkeit;
|
||||
}
|
||||
|
||||
public function ausgeben()
|
||||
{
|
||||
parent::ausgeben();
|
||||
echo "Die Höchstgeschwindigkeit beträgt " .$this->hoechstgeschwindigkeit ." km/h <br>";
|
||||
}
|
||||
}
|
||||
|
||||
$sw1 = new Sportwagen(250);
|
||||
|
||||
$sw1->setHoechstgeschwindigkeit(279);
|
||||
|
||||
$sw1->ausgeben();
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
class Autoklasse {
|
||||
|
||||
// private $geschwindigkeit = 0;
|
||||
|
||||
// der Konstruktor
|
||||
|
||||
public function __construct(private $geschwindigkeit = 0)
|
||||
{
|
||||
//$this->geschwindigkeit = $standart
|
||||
echo "das Objekt wurde erzeugt";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
class Autoklasse {
|
||||
|
||||
public function getGeschwindigkeit() {
|
||||
|
||||
return $this->geschwindigkeit;
|
||||
|
||||
}
|
||||
|
||||
public function setGeschwindigkeit($neuerWert) {
|
||||
|
||||
$this->geschwindigkeit = $neuerWert;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Entsprechende Aufrufe sehen dann wie folgt aus (vorausgesetzt, es gibt bereits ein Objekt $auto1 vom Typ Autoklasse):
|
||||
|
||||
$auto1->setGeschwindigkeit(100);
|
||||
|
||||
echo $auto1->getGeschwindigkeit();
|
||||
|
||||
//Die erste Anweisung setzt den Wert von $geschwindigkeit auf 100. Die zweite gibt den jetzt geänderten Wert aus.
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
class Konto
|
||||
{
|
||||
private int $kontonummer;
|
||||
private float $kontostand;
|
||||
private string $inhaber;
|
||||
|
||||
public function __construct($kn = 000000, $ks = 000.00, $ki = "max, Mustermann")
|
||||
{
|
||||
$this->kontonummer = $kn;
|
||||
$this->kontostand = $ks;
|
||||
$this->inhaber = $ki;
|
||||
|
||||
echo "<p>Konto: " .$this->kontonummer ." wurde erfolgreich angelegt</p>";
|
||||
echo "<p>Kontoinhaber: " .$this->inhaber ."</p>";
|
||||
echo "<p>Kontostand: " .$this->kontostand ." Euro</p>";
|
||||
echo "<hr><br><hr>";
|
||||
}
|
||||
|
||||
public function einzahlung(float $wert)
|
||||
{
|
||||
$this->kontostand = $this->kontostand + $wert;
|
||||
|
||||
echo "<p>Der Betrag " .$wert ."€ wurde auf das Konto mit der Kontonummer " .$this->kontonummer ." eingezahlt. <br>";
|
||||
echo "Neuer Kontostand beträgt: " .$this->kontostand ."€</p>";
|
||||
echo "<hr><hr>";
|
||||
|
||||
}
|
||||
|
||||
public function abheben(float $wert)
|
||||
{
|
||||
if ($this->kontostand - $wert > 0)
|
||||
{
|
||||
$this->kontostand = $this->kontostand - $wert;
|
||||
echo "<p>Der Betrag " .$wert ."€ wurde vom Konto mit der Kontonummer " .$this->kontonummer ." ausgezahlt. <br>";
|
||||
echo "Neuer Kontostand beträgt: " .$this->kontostand ."€</p>";
|
||||
echo "<hr><hr>";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<p>Nicht genug Guthaben zum auszahlen auf dem Konto " .$this->kontonummer ."</p>";
|
||||
//echo "Nic";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,68 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||
<title>Testformular</title>
|
||||
<?php
|
||||
require("test2.php")
|
||||
?>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<fileset>
|
||||
<form action="<?php //echo $_SERVER["PHP_SELF"]; ?>" method="post">
|
||||
<p>
|
||||
<label for="kontonummer">Kontonummer Eingeben:</label>
|
||||
<input type="text" name="kontonummer" id="kontonummer" placeholder="Kontonummer" required autofocus value="<?= htmlspecialchars($_POST['kontonummer']) ?? '' ?>">
|
||||
</p>
|
||||
<p>
|
||||
<label for="betrag">Betrag eingeben</label>
|
||||
<input type="text" name="betrag" id="betrag" placeholder="Betrag" value="<?= htmlspecialchars($_POST['betrag']) ?? '' ?>">
|
||||
</p>
|
||||
<p>
|
||||
<label for="name">Ihr Name</label>
|
||||
<input type="text" name="name" id="name" placeholder="Ihr Name" value="<?= htmlspecialchars($_POST['name']) ?? '' ?>">
|
||||
</p>
|
||||
<p>
|
||||
<input type="radio" name="operator" id="erstellen">
|
||||
<label for="erstellen">Konto Erstellen</label>
|
||||
<input type="radio" name="operator" id="einzahlen">
|
||||
<label for="einzahlen">Einzahlen</label>
|
||||
<input type="submit" value="Ausführen">
|
||||
</p>
|
||||
<p>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
switch($_POST['operator'])
|
||||
{
|
||||
case "einzahlen":
|
||||
$test->einzahlung($_POST['betrag']);
|
||||
break;
|
||||
|
||||
case "erstellen":
|
||||
if (is_numeric($_POST['kontonummer']) && is_numeric($_POST['betrag']) && is_string($_POST['name']) == 1)
|
||||
{
|
||||
$test = new Konto($_POST['kontonummer'], $_POST['betrag'],$_POST['name']);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//$test->einzahlung($_POST['betrag']);
|
||||
|
||||
//$wert1 = $_POST['kontonummer'];
|
||||
//$wert2 = $_POST['betrag'];
|
||||
//$wert3 = $_POST['name'];
|
||||
|
||||
//echo $wert1, $wert2, $wert3;
|
||||
|
||||
//$test = new Konto($wert1, $wert2, $wert3);
|
||||
|
||||
?>
|
||||
</p>
|
||||
</form>
|
||||
</fileset>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
class Person
|
||||
{
|
||||
protected string $Nname;
|
||||
protected string $Vname;
|
||||
|
||||
|
||||
public function __construct(string $nach, string $vor)
|
||||
{
|
||||
$this->Nname = $nach;
|
||||
$this->Vname = $vor;
|
||||
}
|
||||
|
||||
public function setName(string $nach): void
|
||||
{
|
||||
$this->Nname = $nach;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->Nname;
|
||||
}
|
||||
|
||||
public function setVorname(string $vor): void
|
||||
{
|
||||
$this->Vname = $vor;
|
||||
}
|
||||
|
||||
public function getVorname()
|
||||
{
|
||||
return $this->Vname;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
class Mitarbeiter extends Person
|
||||
{
|
||||
private int $gruppierung = 0;
|
||||
private int $steuerklasse = 0;
|
||||
private int $kontonummer = 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
class Kunde extends Person
|
||||
{
|
||||
private int $bonitaet = 0;
|
||||
|
||||
public function setBonitaet(int $wert): void
|
||||
{
|
||||
$this->bonitaet = $wert;
|
||||
}
|
||||
|
||||
public function getBonitaet()
|
||||
{
|
||||
return $this->bonitaet;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var_dump($strom = new Person("Fischer", "Fritz"));
|
||||
|
||||
var_dump($strom = new Mitarbeiter("Schulze","Maria"));
|
||||
|
||||
var_dump($strom = new Kunde("Fähnrich", "Timon"));
|
||||
?>
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
class Konto
|
||||
{
|
||||
private int $kontonummer;
|
||||
private float $kontostand;
|
||||
private string $inhaber;
|
||||
|
||||
public function __construct($kn = 000000, $ks = 000.00, $ki = "max, Mustermann")
|
||||
{
|
||||
$this->kontonummer = $kn;
|
||||
$this->kontostand = $ks;
|
||||
$this->inhaber = $ki;
|
||||
|
||||
echo "<p>Konto: " .$this->kontonummer ." wurde erfolgreich angelegt</p>";
|
||||
echo "<p>Kontoinhaber: " .$this->inhaber ."</p>";
|
||||
echo "<p>Kontostand: " .$this->kontostand ." Euro</p>";
|
||||
echo "<hr><br><hr>";
|
||||
}
|
||||
|
||||
public function einzahlung(float $wert)
|
||||
{
|
||||
$this->kontostand = $this->kontostand + $wert;
|
||||
|
||||
echo "<p>Der Betrag " .$wert ."€ wurde auf das Konto mit der Kontonummer " .$this->kontonummer ." eingezahlt. <br>";
|
||||
echo "Neuer Kontostand beträgt: " .$this->kontostand ."€</p>";
|
||||
echo "<hr><hr>";
|
||||
}
|
||||
|
||||
public function abheben(float $wert)
|
||||
{
|
||||
if ($this->kontostand - $wert >= 0)
|
||||
{
|
||||
$this->kontostand = $this->kontostand - $wert;
|
||||
echo "<p>Der Betrag " .$wert ."€ wurde vom Konto mit der Kontonummer " .$this->kontonummer ." ausgezahlt. <br>";
|
||||
echo "Neuer Kontostand beträgt: " .$this->kontostand ."€</p>";
|
||||
echo "<hr><hr>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<p>Nicht genug Guthaben zum Auszahlen auf dem Konto " .$this->kontonummer ."</p>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$mayer = new Konto(123, 1000, "Meier, Hans");
|
||||
|
||||
$mayer->einzahlung(500.50);
|
||||
|
||||
$schulze = new Konto(789, 12300.5, "Schulze, Claudia");
|
||||
|
||||
$schulze->einzahlung(20.50);
|
||||
|
||||
$mayer->abheben(50.75);
|
||||
|
||||
$schulze->abheben(20000);
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||
<title>Vererbung</title>
|
||||
<?php
|
||||
include_once("3_2_autoklasse.php")
|
||||
?>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
class Sportwagen extends Autoklasse
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
$sw = new Sportwagen(250);
|
||||
$sw->ausgeben();
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user