add Programmyday form github
This commit is contained in:
49
Parkplatz2/Parkbox.cs
Normal file
49
Parkplatz2/Parkbox.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Parkplatz2
|
||||
{
|
||||
class Parkbox
|
||||
{
|
||||
private int id;
|
||||
private Auto auto;
|
||||
|
||||
public Parkbox(int id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
public int GetId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public bool IstLeer()
|
||||
{
|
||||
return auto == null;
|
||||
}
|
||||
public bool Einparken(Auto auto)
|
||||
{
|
||||
if (IstLeer())
|
||||
{
|
||||
this.auto = auto;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public Auto Ausparken(string kennzeichen)
|
||||
{
|
||||
if (!IstLeer())
|
||||
{
|
||||
if (kennzeichen == auto.GetKennzeichen())
|
||||
{
|
||||
Auto help = auto;
|
||||
auto = null;
|
||||
return help;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user