private void DisplayUserCoins(Coin coin) { double PoundFormat = coin.Value / 100; double UserCoinsTotal = VendorCoinManger.UserCoinsTotal() / 100; Console.WriteLine("You Have Inserted £{0:0.00}", PoundFormat); Console.WriteLine("Total Paid £{0:0.00}", UserCoinsTotal); }
public void Insert(Coin coin) { VendorCoinManger.Insert(coin); DisplayUserCoins(coin); Console.WriteLine("Total Price £{0:0.00}", SelectionTotalPrice() / 100); CalculateCoinsToPay(); double TotalPrice = SelectionTotalPrice(); Vend(TotalPrice); }
public void Vend(double price) { if (SufficientPayment) { double Change = VendorCoinManger.GiveChange(price) / 100; VendorCoinManger.CoinsToReturn.Clear(); DisplayItemsInSelection(); Selection.Clear(); Console.WriteLine("Your Change: £{0:0.00}", Change); } SufficientPayment = false; }
private void CalculateCoinsToPay() { double TotalPrice = SelectionTotalPrice(); double UserCoinsTotal = VendorCoinManger.UserCoinsTotal(); double CoinsToPay = Math.Floor(TotalPrice / UserCoinsTotal); if (CoinsToPay <= 0) { SufficientPayment = true; } if (CoinsToPay > 0) { Console.WriteLine("Please Insert more coins To Complete purchase"); } }