2
0

add: files from last time and task

This commit is contained in:
cwikladaniel
2025-11-20 10:33:46 +01:00
parent 25f63a161b
commit be203da14d
5 changed files with 156 additions and 0 deletions

58
Zweites Jahr/Rechteck.class.php Executable file
View File

@@ -0,0 +1,58 @@
<?php
class Rechteck
{
//Attribute
private float $seiteA;
private float $seiteB;
private string $farbe;
//SET-Methoden
public function setSeiteA($sA)
{
//Plausibilitätskontrolle
if($sA<0){$sA*=-1;}
$this->seiteA=$sA;
}
public function setSeiteB($sB)
{
$this->seiteB=$sB;
}
public function setFarbe($f)
{
$this->farbe=$f;
}
// GET-Methoden
public function getSeiteA(): float
{
return $this->seiteA;
}
public function getSeiteB(): float
{
return $this->seiteB;
}
public function getFarbe(): string
{
return $this->farbe;
}
// Andere Methoden
public function showFlaeche()
{
//$seiteA=$this-seiteA;
$ergebnis=$this->seiteA*$this->seiteB;
echo "<p>{$this->seiteA} * {$this->seiteB} = {$ergebnis}</p>";
}
}
?>