Here is a Budget App created by objects based on different budget categories like food, clothing, and entertainment. The objects are based on different budget categories like food, clothing, and entertainment. When objects are created, they are passed in the name of the category. The class should have an instance variable called ledger which is a list. A deposit method that accepts an amount and description. If no description is given, it should default to an empty string. The method should append an object to the ledger list in the form of {"amount": amount, "description": description}. A wiwithdrawalethod that is similar to the deposit method, but the amount passed in should be stored in the ledger as a negative number. If there are not enough funds, nothing should be added to the ledger. This method should return True if the withdrawal took place, and False otherwise. A get_balance method returns the current balance of the budget category based on the deposits and withdrawals that have occurred. A transfer method that accepts an amount and another budget category as arguments. The method should add a withdrawal with the amount and the description "Transfer to [Destination Budget Category]". The method should then add a deposit to the other budget category with the amount and the description "Transfer from [Source Budget Category]". If there are not enough funds, nothing should be added to either ledger. This method should return True if the transfer took place, and False otherwise. A check_funds method that accepts an amount as an argument. It returns False if the amount is greater than the balance of the budget category and returns True otherwise. This method should be used by both the withdrawal method and the transfer method.
-
Notifications
You must be signed in to change notification settings - Fork 0
Abbsal/Budget-App
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Here is a Budget App created by objects based on different budget categories like food, clothing, and entertainment.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published