- A
ChimpanzeeimplementingIMoneyCollectorcan act as the booth's money collector.
Chimpanzee implementing IMoneyCollector can act as the booth's money collector.Chimpanzee class implement the IMoneyCollector interface.
MoneyBalance property should always return 0m.AddMoney method, write a comment to buy some bananas. The method should do nothing else.RemoveMoney method return 0.Chimpanzee in the constructor of the MoneyCollectingBooth.
AddMoney and RemoveMoney methods step into the Chimpanzee class and do not have the expected functionality of an actual money collector.The Chimpanzee should be more interested in bananas than collecting money.
MoneyCollectingBooth's constructor add the moneyBox of type IMoneyCollector as a parameter.
IMoneyCollector parameter within the MoneyCollectingBooth's constructor instead of instantiating a new Chimpanzee.Chimpanzee.MoneyCollectingBooth's behavior remains the same. The Chimpanzee should still like bananas more than money.ticketBooth's Chimpanzee to an actual MoneyBox.IMoneyCollector from the Chimpanzee class and any methods/properties relating to money stuffs.AddMoney in the MoneyCollectingBooth class and run the WPF application.AddMoney method steps into the MoneyCollector class and has the expected functionality of a money collector.
moneyBox parameter of type IMoneyCollector.moneyBox field to the passed-in moneyBox.moneyBox for the animalSnackMachine.Account class in a new project called Accounts as specified in the diagram below.
RemoveMoney method, subtract the passed-in amount from the money balance and return the passed-in amount.This allows the account balance to go negative.
MoneyBox in the animalSnackMachine, create a new Account in its place.
MoneyCollector class abstract.VendingMachine's AddMoney method, it steps into the Account's AddMoney method.feedAnimalButton, get the selected guest and animal.Guest guest = this.guestListBox.SelectedItem as Guest;PopulateAnimalListBox method and the PopulateGuestListBox method.Otherwise, tell the user that they must choose both a guest and an animal to feed an animal.
SelectedItem of the guestListBox and the SelectedItem of animalListBox to the guest and animal variable respectively in order to keep both the guest and the animal selected after the button click.Ensure the following:
Guest class called checkingAccount of type IMoneyCollector.
Account.
WithdrawMoney method.WithdrawMoney method in the Guest class.WithdrawMoney method.FeedAnimal method, after getting the food price, check if the wallet's money balance is less than the food price.If so, withdraw 5 times the amount of the food price.
VisitTicketBooth method, check that the wallet's money balance is less than the ticket price and the water bottle price.If it is, withdraw twice the amount of the TicketPrice to cover the cost..
this.wallet.MoneyBalance < (ticketBooth.TicketPrice + ticketBooth.WaterBottlePrice)ToString method. Make sure that it looks like the followingName: Age [$MoneyBalance / $Account]
Greg: 44 [$150.35 / $50.00]MoneyBalance to $15 and the Shark's Weight to 2000.VIsitTicketBooth method.At the end of the VisitTicketBooth method he should have $27 and his CheckingAccount should have $20.
FeedAnimal button.It's $30 to feed a Shark so his wallet balance should be $147 (he pulled out $150, plus the $27 would be $177, minus the $30 to feed would be $147) and his account balance should be -$130.00 ($20 - $150).
Wallet class implement IMoneyCollector.
Guest constructor.
IMoneyCollector. Assign the checking account using the passed-in account.NewZoo method.
Account and store it in a variable.AddMoney method.Wallet (using the Wallet property) into her account parameter."account" should be $27, the same as Greg's wallet.FeedAnimal button.FeedAnimal button 5 more times.Her new wallet balance should be $5.94 and her account balance and Greg's wallet should be $20.15.
FeedAnimal button.Eventually Darla will use up all of her money both in her wallet and in Greg's wallet (since it's actually a Wallet and not really an Account) and she will no longer be able to feed any animals.
Greg will should pull money from his account into his wallet and Darla's "account" should be replenished as well.
Account ProjectIMoneyCollector interface© 2026 Northcentral Technical College