Initialized the CoffeeVendingMachine.cs class
Rewrote from get/set like in the README
This commit is contained in:
parent
c81ca36d28
commit
bc7f2da775
3 changed files with 91 additions and 3 deletions
|
|
@ -2,5 +2,92 @@
|
|||
|
||||
public class CoffeeVendingMachine
|
||||
{
|
||||
private static readonly CoinType[] withdrawalOrder;
|
||||
private readonly CoinDepot[] _currentChangeCoins;
|
||||
private readonly CoinDepot[] _currentInputCoins;
|
||||
private readonly Product[] _products;
|
||||
|
||||
public readonly string Location;
|
||||
public readonly int TotalChangeAmountInMachine;
|
||||
public readonly int TotalMoneyCurrentlyInput;
|
||||
public readonly Product[] AvailableProducts;
|
||||
|
||||
public CoffeeVendingMachine(CoinDepot[] coinDepots, Product[] products, string location)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
public CoffeeVendingMachine(string location)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
public CoinDepot[] Cancel()
|
||||
{
|
||||
//TODO
|
||||
return [];
|
||||
}
|
||||
|
||||
public bool InsertCoin(CoinType coin)
|
||||
{
|
||||
//TODO
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool SelectProduct(string productName, out CoinDepot[]? change, out int? price)
|
||||
{
|
||||
//TODO
|
||||
change = null;
|
||||
price = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
//TODO
|
||||
return "";
|
||||
}
|
||||
|
||||
private void AddInputToChange()
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
private static CoinDepot[] CreateCoinDepots(int count)
|
||||
{
|
||||
//TODO
|
||||
return [];
|
||||
}
|
||||
|
||||
private static Product[] CreateDefaultProducts()
|
||||
{
|
||||
//TODO
|
||||
return [];
|
||||
}
|
||||
|
||||
private static CoinDepot? GetDepotByType(CoinDepot[] coinDepots, CoinType coinType)
|
||||
{
|
||||
//TODO
|
||||
return null;
|
||||
}
|
||||
|
||||
private int? PrepareChangeCoins(int amount, out CoinDepot[] changeCoins)
|
||||
{
|
||||
//TODO
|
||||
changeCoins = [];
|
||||
return null;
|
||||
}
|
||||
|
||||
private static int SumDepotValue(CoinDepot[] coinDepots)
|
||||
{
|
||||
//TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
private bool TryFindProduct(string productName, out Product? product)
|
||||
{
|
||||
//TODO
|
||||
product = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ namespace CoffeeVendingMachines;
|
|||
|
||||
public class CoinDepot
|
||||
{
|
||||
public CoinType Coin { get; }
|
||||
public readonly CoinType Coin;
|
||||
public int Count { get; private set; }
|
||||
|
||||
public CoinDepot(CoinType coin, int count = 0)
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ public class Product
|
|||
public const int FallbackPrice = 50;
|
||||
private readonly int _price;
|
||||
private int _stock;
|
||||
public bool InStock => _stock > 0;
|
||||
public string Name { get; }
|
||||
public readonly bool InStock;
|
||||
public readonly string Name;
|
||||
public int NumberSold { get; private set; }
|
||||
public int Price { get; private init; }
|
||||
|
||||
|
|
@ -15,6 +15,7 @@ public class Product
|
|||
Name = name;
|
||||
_price = price;
|
||||
_stock = stock;
|
||||
InStock = _stock > 0;
|
||||
}
|
||||
|
||||
public bool AddSale()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue