add: files from last time and task
This commit is contained in:
58
Zweites Jahr/Rechteck.class.php
Executable file
58
Zweites Jahr/Rechteck.class.php
Executable 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>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user