public static void Main(string[] args) { PaymentCard petesCard = new PaymentCard(10); Console.WriteLine("money " + petesCard.balance); bool wasSuccessful = petesCard.TakeMoney(8); Console.WriteLine("successfully withdrew: " + wasSuccessful); Console.WriteLine("money " + petesCard.balance); wasSuccessful = petesCard.TakeMoney(4); Console.WriteLine("successfully withdrew: " + wasSuccessful); Console.WriteLine("money " + petesCard.balance); }
public static void Main(string[] args) { // Try your code here, if you want PaymentCard munCard = new PaymentCard(10); Console.WriteLine(munCard.ToString()); bool result = munCard.TakeMoney(8); Console.WriteLine("succesfully withdrew: " + result.ToString()); Console.WriteLine(munCard.ToString()); result = munCard.TakeMoney(8); Console.WriteLine("succesfully withdrew: " + result.ToString()); Console.WriteLine(munCard.ToString()); PaymentTerminal lunchCafeteria = new PaymentTerminal(); Console.WriteLine(lunchCafeteria); PaymentCard annesCard = new PaymentCard(2); Console.WriteLine("amount of money on the card is " + annesCard.balance + " euros"); bool wasSuccessful = lunchCafeteria.EatLunch(annesCard); Console.WriteLine("there was enough money: " + wasSuccessful); lunchCafeteria.AddMoneyToCard(annesCard, 100); Console.WriteLine("amount of money on the card is " + annesCard.balance + " euros"); Console.WriteLine(lunchCafeteria); wasSuccessful = lunchCafeteria.EatLunch(annesCard); Console.WriteLine("there was enough money: " + wasSuccessful); Console.WriteLine("amount of money on the card is " + annesCard.balance + " euros"); Console.WriteLine(lunchCafeteria); }