/// <summary> /// Initializes a new instance of the MoneyCollectingBooth class. /// </summary> /// <param name="attendent"> The attendant for the booth.</param> /// <param name="ticketPrice"> The price of the tickets.</param> /// <param name="waterBottlePrice"> The price of the water bottles.</param> public MoneyCollectingBooth(Employee attendant, decimal ticketPrice, decimal waterBottlePrice, IMoneyCollector moneyBox) : base(attendant) { this.moneyBox = moneyBox; this.ticketPrice = ticketPrice; this.waterBottlePrice = waterBottlePrice; // Creates 5 tickets. for (int t = 0; t < 5; t++) { // Create a variable of type ticket and pass in the correct parameters. Ticket ticket = new Ticket(15, t + 1, .01); Items.Add(ticket); } // Creates 5 water bottles. for (int w = 0; w < 5; w++) { // Creates a new water bottle and pass in the correct parameters. WaterBottle waterBottle = new WaterBottle(3, w + 1, 1); Items.Add(waterBottle); this.waterBottlePrice = waterBottle.Price; } }
/// <summary> /// Initializes a new instance of the MoneyCollectingBooth class. /// </summary> /// <param name="attendant">The booth's attendant.</param> /// <param name="ticketPrice">The price of the ticket.</param> /// <param name="waterBottlePrice">The price of the water bottle.</param> /// <param name="moneyBox">The money box used to house money.</param> public MoneyCollectingBooth(Employee attendant, decimal ticketPrice, decimal waterBottlePrice, IMoneyCollector moneyBox) : base(attendant) { this.ticketPrice = ticketPrice; this.waterBottlePrice = waterBottlePrice; this.moneyBox = moneyBox; //// this.moneyBox.AddMoney(42.75m); // Instantiates a new ticket stack. this.ticketStack = new Stack <Ticket>(); // Create tickets with unique serial numbers and add them to the list. for (int i = 0; i < 5; i++) { Ticket ticket = new Ticket(15.00m, i, .01); i = ticket.SerialNumber; ////this.Items.Add(ticket); this.ticketStack.Push(ticket); } // Create water bottles with unique serial numbers and add them to the list. for (int i = 0; i < 5; i++) { WaterBottle waterBottle = new WaterBottle(this.WaterBottlePrice, i, 1); i = waterBottle.SerialNumber; this.Items.Add(waterBottle); } }
/// <summary> /// Initializes a new instance of the Wallet class. /// </summary> /// <param name="color">The color of the wallet.</param> public Wallet(WalletColor color) { this.color = color; // Creates a new money pocket for the wallet. this.moneyPocket = new MoneyPocket(); }
/// <summary> /// Initializes a new instance of the Wallet class. /// </summary> /// <param name="color">The color of the wallet.</param> public Wallet(WalletColor color) { this.moneyPocket = new MoneyPocket(); // Plug the handleBalanceChange method into the OnBalanceChange. this.moneyPocket.OnBalanceChange += this.HandleBalanceChange; }
/// <summary> /// Initializes a new instance of the VendingMachine class. /// </summary> /// <param name="foodPrice">The price of food (per pound).</param> /// <param name="moneyBox">The vending machine's money box.</param> public VendingMachine(decimal foodPrice, IMoneyCollector moneyBox) { this.foodPricePerPound = foodPrice; this.moneyBox = moneyBox; // Fill vending machine with an initial load of food. this.foodStock = this.maxFoodStock; }
/// <summary> /// Initializes a new instance of the Guest class. /// </summary> /// <param name="name">The name of the guest.</param> /// <param name="age">The age of the guest.</param> /// <param name="moneyBalance">The initial amount of money to put into the guest's wallet.</param> /// <param name="Color">The color of the guest's wallet.</param> public Guest(string name, int age, decimal moneyBalance, WalletColor Color, Gender gender, IMoneyCollector checkingAccount) { this.checkingAccount = checkingAccount; //this.checkingAccount.AddMoney(2500.00m); this.age = age; this.bag = new List <Item>(); this.name = name; this.wallet = new Wallet(Color); this.wallet.AddMoney(moneyBalance); }
/// <summary> /// Initializes a new instance of the Wallet class. /// </summary> /// <param name="color">The color of the wallet.</param> /// <param name="moneyPocket">The wallet's money pocket.</param> public Wallet(WalletColor color, IMoneyCollector moneyPocket) { this.color = color; this.moneyPocket = moneyPocket; this.moneyPocket.OnBalanceChange = () => { this.OnBalanceChange?.Invoke(); }; }
/// <summary> /// Initializes a new instance of the VendingMachine class. /// </summary> /// <param name="foodPrice">The price of food (per pound).</param> /// <param name="moneyBox">The vending machine's money box.</param> public VendingMachine(decimal foodPrice, IMoneyCollector moneyBox) { this.foodPricePerPound = foodPrice; this.moneyBox = moneyBox; // Fill with an initial load of food. while (!this.IsFull()) { this.AddFoodBag(); } }
/// <summary> /// Initializes a new instance of the VendingMachine class. /// </summary> /// <param name="foodPrice">The price of food (per pound).</param> public VendingMachine(decimal foodPrice, Account moneyBox) { this.foodPricePerPound = foodPrice; this.moneyBox = moneyBox; this.moneyBox.AddMoney(42.75m); // Fill with an initial load of food. while (!this.IsFull()) { this.AddFoodBag(); } }
/// <summary> /// Initializes a new instance of the Wallet class. /// </summary> /// <param name="color">The color of the wallet.</param> /// <param name="moneyPocket">The wallet's money pocket.</param> public Wallet(WalletColor color, IMoneyCollector moneyPocket) { this.color = color; this.moneyPocket = moneyPocket; this.moneyPocket.OnBalanceChange = () => { if (this.OnBalanceChange != null) { this.OnBalanceChange(); } }; }
/// <summary> /// Initializes a new instance of the Guest class. /// </summary> /// <param name="name">The name of the guest.</param> /// <param name="age">The age of the guest.</param> /// <param name="walletColor">The color of the guest's wallet.</param> /// <param name="moneyBalance">The money balance of the guest's wallet.</param> /// <param name="gender">The gender of the guest.</param> /// <param name="checkingAccount">The account for collecting money.</param> public Guest(string name, int age, WalletColor walletColor, decimal moneyBalance, Gender gender, IMoneyCollector checkingAccount) { this.age = age; this.checkingAccount = checkingAccount; this.checkingAccount.OnBalanceChange += this.HandleBalanceChange; this.gender = gender; this.name = name; this.CreateTimers(); this.wallet = new Wallet(walletColor, new MoneyPocket()); this.wallet.AddMoney(moneyBalance); this.wallet.OnBalanceChange += this.HandleBalanceChange; this.XPosition = 0; this.YPosition = 0; }
/// <summary> /// Initializes a new instance of the Guest class. /// </summary> /// <param name="name">The name of the guest.</param> /// <param name="age">The age of the guest.</param> /// <param name="moneyBalance">The initial amount of money to put into the guest's wallet.</param> /// <param name="Color">The color of the guest's wallet.</param> public Guest(string name, int age, decimal moneyBalance, WalletColor Color, Gender gender, IMoneyCollector checkingAccount) { this.adpotedAnimal = this.AdoptedAnimal; this.age = age; this.bag = new List <Item>(); this.checkingAccount = checkingAccount; this.name = name; this.wallet = new Wallet(Color); this.wallet.AddMoney(moneyBalance); // Set the x and y axis positions. this.YPosition = 0; this.XPosition = 0; }
/// <summary> /// Initializes a new instance of the Guest class. /// </summary> /// <param name="name">The name of the guest.</param> /// <param name="age">The age of the guest.</param> /// <param name="moneyBalance">The initial amount of money to put into the guest's wallet.</param> /// <param name="walletColor">The color of the guest's wallet.</param> /// <param name="gender">The guest's gender.</param> /// <param name="checkingAccount">The guest's checking account.</param> public Guest(string name, int age, decimal moneyBalance, WalletColor walletColor, Gender gender, IMoneyCollector checkingAccount) { this.age = age; this.name = name; this.wallet = new Wallet(walletColor); this.wallet.AddMoney(moneyBalance); this.gender = gender; this.checkingAccount = checkingAccount; // Creates the bag of items. this.bag = new List <Item>(); // Initialize positions. this.XDirection = 0; this.YPosition = 0; }
/// <summary> /// Initializes a new instance of the MoneyCollectingBooth class. /// </summary> /// <param name="attendant">The booth's attendant.</param> /// <param name="ticketPrice">The booth's ticket price.</param> /// <param name="waterBottlePrice">The booth's water bottle price.</param> /// <param name="moneyBox">The booth's money box.</param> public MoneyCollectingBooth(Employee attendant, decimal ticketPrice, decimal waterBottlePrice, IMoneyCollector moneyBox) : base(attendant) { this.ticketPrice = ticketPrice; this.waterBottlePrice = waterBottlePrice; this.moneyBox = moneyBox; this.ticketStack = new Stack <Ticket>(); // Create tickets. for (int i = 0; i < 5; i++) { this.ticketStack.Push(new Ticket(this.TicketPrice, i + 1, 0.01)); } // Create water bottles. for (int i = 0; i < 5; i++) { this.Items.Add(new WaterBottle(this.WaterBottlePrice, i + 1, 1)); } }
/// <summary> /// Initializes a new instance of the MoneyCollectingBooth class. /// </summary> /// <param name="attendant">The booth's attendant.</param> /// <param name="ticketPrice">The booth's ticket price.</param> /// <param name="waterBottlePrice">The booth's water bottle price.</param> /// <param name="moneyBox">The booth's money box.</param> public MoneyCollectingBooth(Employee attendant, decimal ticketPrice, decimal waterBottlePrice, IMoneyCollector moneyBox) : base(attendant) { this.ticketPrice = ticketPrice; this.waterBottlePrice = waterBottlePrice; this.moneyBox = moneyBox; this.ticketStack = new Stack <Ticket>(); // Set the intial money balance. this.AddMoney(MoneyCollectingBooth.InitialMoneyBalance); for (int i = 0; i < 5; i++) { this.ticketStack.Push(new Ticket(this.TicketPrice, i + 1, 0.01)); } for (int i = 0; i < 5; i++) { this.Items.Add(new WaterBottle(this.WaterBottlePrice, i + 1, 1)); } }
/// <summary> /// Initializes a new instance of the Wallet class. /// </summary> /// <param name="color">The color of the wallet.</param> public Wallet(WalletColor color) { this.moneyPocket = new MoneyPocket(); }
/// <summary> /// /// </summary> public Wallet(string color, decimal moneyBalance) { this.color = color; this.moneyPocket = new MoneyCollector(moneyBalance); // moneyBalance = this.MoneyBalance; }
/// <summary> /// Initializes a new instance of the money collecting stand class. /// </summary> /// <param name="itemPrice"> The price of the item.</param> /// <param name="itemType"> The item's type.</param> /// <param name="moneyBox"> The box full of money.</param> public MoneyCollectingStand(decimal itemPrice, string itemType, IMoneyCollector moneyBox) : base(itemType) { this.itemPrice = itemPrice; this.moneyBox = moneyBox; }
/// <summary> /// Initializes a new instance of the popcorn stand class. /// </summary> /// <param name="itemPrice"> The price of the items.</param> /// <param name="moneyBox"> The box for money.</param> public PopcornStand(decimal itemPrice, IMoneyCollector moneyBox) : base(itemPrice, "popcorn", moneyBox) { base.moneyBox = moneyBox; this.itemPrice = itemPrice; }
/// <summary> /// Initializes a new instance of the PopcornStand class. /// </summary> /// <param name="itemPrice">The price of an item.</param> /// <param name="moneyBox">The stand's money collector.</param> public PopcornStand(decimal itemPrice, IMoneyCollector moneyBox) : base(itemPrice, "Popcorn", moneyBox) { }
/// <summary> /// Initializes a new instance of the SodaCupStand class. /// </summary> /// <param name="itemPrice">The price of an item.</param> /// <param name="moneyBox">The soda cup stand's money collector.</param> public SodaCupStand(decimal itemPrice, IMoneyCollector moneyBox) : base(itemPrice, "Soda cup", moneyBox) { }
/// <summary> /// Initializes a new instance of the Wallet class. /// </summary> /// <param name="color">The wallet's color.</param> /// <param name="moneyBalance">The wallet's money balance.</param> public Wallet(WalletColor color, decimal moneyBalance) { this.color = color; this.moneyPocket = new MoneyCollector(moneyBalance); }
/// <summary> /// /// </summary> /// <param name="itemPrice"></param> /// <param name="moneyBox"></param> public SodaCupStand(decimal itemPrice, IMoneyCollector moneyBox) : base(itemPrice, "soda", moneyBox) { this.itemPrice = itemPrice; this.moneyBox = new MoneyCollector(this.MoneyBalance); }