Files
Std_Caisses/Caisses/Checkout.cs
T

38 lines
1002 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Caisses
{
internal class Checkout
{
public const int MAX_CAPACITY = 5;
private List<Client> clients;
private bool open;
private int crossoverTime;
public List<Client> Clients { get => clients; set => clients = value; }
public bool Open { get => open; set => open = value; }
public Checkout()
{
Clients = new List<Client>();
Open = false;
}
public void Tick(int averageWaitingTime, int CrossoverTime, int openedCheckoutsCount)
{
if (!Open && averageWaitingTime > CrossoverTime || openedCheckoutsCount == 0)
{
Open = true;
}
if (Open && averageWaitingTime < 1 && Clients.Count == 0 && openedCheckoutsCount > 1)
{
Open = false;
}
}
}
}