add Programmyday form github
This commit is contained in:
47
zoo-besucher/Entrance.cs
Normal file
47
zoo-besucher/Entrance.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace zoo_besucher
|
||||
{
|
||||
internal class Entrance
|
||||
{
|
||||
|
||||
private Visitor[] visitor;
|
||||
private int salesVolume;
|
||||
private int visitorCount;
|
||||
public Entrance(int anzahl)
|
||||
{
|
||||
visitor = new Visitor[anzahl];
|
||||
}
|
||||
public bool AddVisitor(Visitor visotorCount)
|
||||
{
|
||||
for (int i = 0; i < visitor.Length; i++)
|
||||
{
|
||||
if (visitor[i] is null)
|
||||
{
|
||||
visitor[i] = visotorCount;
|
||||
salesVolume += visitor[i].GetEntriy();
|
||||
visitorCount += visitor[i].GetVisitorCount();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public int GetTurnover()
|
||||
{
|
||||
return salesVolume;
|
||||
}
|
||||
public int GetVisitor()
|
||||
{
|
||||
return visitorCount;
|
||||
}
|
||||
public void GetPrintInfo()
|
||||
{
|
||||
Console.WriteLine($"Die Besucherzahlt beträgt: {GetVisitor()}");
|
||||
Console.WriteLine($"Die Einnahmen belaufen sich auf: {GetTurnover()}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user