#budget program
def MAIN_MENU(userName):
choice = "no"
totalBudget = 4000.00
while choice == "no":
print
print ("Welcome %s your budget is currently %.2f") %(userName, totalBudget)
print
print ("Please make a selection from the menu below: ")
print
print (" -1- Add New Expense ")
print (" -2- Remove Expense")
print (" -3- Add Revnue")
print (" -4- Remove Revenue")
print (" -5- QUIT")
print
userInput = input("Enter your selection: ")
if userInput == 1:
totalBudget = ADD_EXPENSE(totalBudget)
elif userInput == 2:
totalBudget = REMOVE_EXPENSE(totalBudget)
elif userInput == 3:
ADD_REVENUE()
elif userInput == 4:
REMOVE_REVENUE()
elif userInput == 5:
choice = "yes"
else:
print ("Invalid option please select a number between 1-5")
def ADD_REVENUE():
pass
def REMOVE_REVENUE():
pass
def REMOVE_EXPENSE(totalBudget):
userInput = "yes"
while userInput == "yes":
expense = input("Enter the expense amount you would like to remove: ")
frequency = input("Enter the frequency of the expense: ")
totalExpense = expense * frequency
print ("The total amount of expense to be remvove is $%.2f") %(expense)
print ("Its frequency is %s") %(frequency)
if totalExpense > 4000.00:
print ("Unable to remove expense because it will cause your total budget to exceed $4000.00")
elif totalExpense < 4000.00:
totalBudget = totalBudget + totalExpense
print("Expense removed")
return totalBudget
def ADD_EXPENSE(totalBudget):
userInput = "yes"
while userInput == "yes":
newExpense = int(raw_input("Enter expense amount: ")
frequencyEX = input ("How many times does expense need to be deducted this month? ")
totalExpense = frequencyEX * newExpense
if totalExpense > totalBudget:
print ("Unable to accept new expense because it exceeds your total budget of: ")
print ("$%.2f") %(totalBudget)
elif totalExpense < totalBudget:
totalBudget = totalBudget - totalExpense
print ("Expense accepted you have a remaing balance of $%.2f") %(totalBudget)
userInput = raw_input("Would you like to enter another expense? ").lower()
if userInput == "no":
return totalBudget
def GOODBYE_MESSAGE(totalBudget, userName):
print ("Goodbye %s your ending budget is %.2f") %(userName, totalBudget)
def WELCOME_MESSAGE():
print("Welcome to your personal budget program! ")
print
userName = raw_input("Please enter your name: ").title()
return userName
def main():
userName = WELCOME_MESSAGE()
totalBudget = MAIN_MENU(userName)
GOODBYE_MESSAGE(totalBudget, userName)
main()
any advice on cleaning this up is welcomed as well. thanks

New Topic/Question
Reply



MultiQuote




|