hey this is my first time asking for help. But i am having trouble making this code. (i think i am over looking it) but here is what i need to do.
::: Design and implement a program to maintain a simple income and expense
budget for a non-profit organization. The organization runs a thrift shop that takes donations of salable goods
and resells them for income. They also accept cash donations. Their expenses fall into 3 categories:
operating (e.g., rent, utilities, etc.), payroll, and charity support. The program will maintain the amount of
cash on hand as well as running totals for sales income, cash donations, operating expenses, payroll expenses,
and support to charities. The program will allow a user to enter both income and expenses of each type, but
expense payments may not exceed the available cash on hand at any time. The user will be able to request a
report listing the totals for each of the expense categories, the total expenses, the total incomes from sales and
donations, the total income, and the cash on hand.


sorry if it was so long but here is what i have so far:

# This program is a simple Non-Profit Budget Manager program that
# allows a user to maintain a simple income and expense budget for
# a non-profit organization.

def main():
    endProgram = 'no'

    while 'no' == endProgram.lower():
        
        print '1. Add an expense amount'
        print '2. Remove an expense amount'
        print '3. Add an income amount'
        print '4. Remove an income amount'
        print '5. Display the income and expense report'
        print '6. Exit the program'
        user_inp = raw_input( 'Enter your choice: ')

        if user_inp == '1':
            addExpense()
        elif user_inp == '2':
            removeExpense()
        elif user_inp == '3':
            addIncome()
        elif user_inp '4':
            removeIncome()
        elif user_inp == '5':
            displayBoth()
        else:
            print 'Are you sure?'

Recommended Answers

All 2 Replies

okay i redid the program so i think i got it but now i am stuck. when i run the program it ask me to enter a number of one of the choices but when i do it than ask me if i want to end the program PLEASE help heres the new code:

# This program is a simple Non-Profit Budget Manager program that
# allows a user to maintain a simple income and expense budget for
# a non-profit organization.

endProgram = 'no'
while 'no' == endProgram.lower() :
    operatingExpense = 0
    payrollExpense = 0
    charitySupport = 0
    
    endProgram = 'no'
    while 'no' == endProgram.lower() :
        print ('1. Add an expense amount')
        print ('2. Remove an expense amount')
        print ('3. Add an income amount')
        print ('4. Remove an income amount')
        print ('5. Display the income and expense report')
        print ('6. Exit the program')
        number = input ('Enter your choice.')
        if number == 1 :
            print ('1. Operating expense')
            print ('2. Payroll expense')
            print ('3. Charity Support')
            print ('4. Cancel')
            number = input ('Enter the Expense you want to add.')
        elif number == 2 :
            print ('1. Operating expense')
            print ('2. Payroll expense')
            print ('3. Charity Support')
            print ('4. Cancel')
            number = input ('Enter the Expense you want to remove.')
        elif number == 3 :
            print ('Enter the income amount')
        elif number == 4 :
            print ('1. sale of donated merchandise')
            print ('2. Cash donation')
        elif number == 5 :
            print ('Operating Expenses  : $'),  operatingExpense
            print ('Payroll Expenses   : $'),  payrollExpense
            print ('Charity Support : $'),  charitySupport
        else :
             number == 6 
             print ('Are you sure you want to end the program?')
             endProgram = input ('Enter yes or no.')

There are several problems.

if number == '1' : #use '1'because input in python 3 return a string.

Then you come to this meny.

print ('1. Operating expense')
print ('2. Payroll expense')
print ('3. Charity Support')
print ('4. Cancel')
number = input ('Enter the Expense you want to add.')

And if choice 1 here,it will off course bring you back to start meny.
because off no if number == '1': do somthing

You use number several time as a variable,dont you think it will be overwritten?
number = input ('Enter the Expense you want to remove.')
number_Expense = (better)

Your first desgin look better.

if user_inp == '1':
    addExpense()

Then make calulation in addExpense() and return value you need.
Then in a main() function but it all together.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.