Question

In: Computer Science

A non-governmental organization needs a program to calculate the amount of financial assistance for needy families....

  1. A non-governmental organization needs a program to calculate the amount of financial assistance for needy families. The formula is as follows:5 pts
  • If the annual household income is between $30,000 and $39,999 and the household has at least three children, the amount is $1000 per child.
  • If the annual household income is between $20,000 and $29,999 and the household has at least two children, the amount is $1500 per child.
  • If the annual household income is less than $20,000, the amount is $2000 per child.

(Note: anything outside these conditions, there is NO financial assistance)

Implement a function for this computation. Write a program that asks for the household income and number of children for each applicant, printing the amount returned by your function. Use a -1 as a sentinel value for the input.

DefcomputeAssistance (income, children)

  1. Your code with comments
  2. A screenshot of the execution

Test Cases:

            Household income = $35,000             No. of children = 4 (should return $1000/child)

            Household income = $25,000             No. of children = 3 (should return $1500/child)

            Household income = $18,000             No. of children = 2 (should return $2000/child)

            Household income = $40,000             No. of children = 1 (should return “No assistance”)

python keep it simple

Solutions

Expert Solution

Answer: Hope your query is resolved :)

# function to calculate the amount of financial assistance for needy families
def computeAssistance (income, children):
# If the annual household income is between $30,000 and $39,999 and the household has at least three children.
    if(income>=30000 and income < 40000 and children >= 3):
        return "$1000/child"
# If the annual household income is between $20,000 and $29,999 and the household has at least two children.
    elif(income>=20000 and income < 430000 and children >= 2):
        return "$1500/child"
# If the annual household income is less than $20,000
    elif(income<20000):
        return "$2000/child"
# Else NO financial assistance
    else:
        return "No assistance"
# For user input
n = int(input('Enter any number to continue or -1 to end : '))
while n != -1 : # Using -1 as a sentinal value
    income = int(input('Enter Annual household income : $'))
    children = int(input('Enter NO. of children : '))
    
    # functional call to compute Financial Assistance
    print(computeAssistance(income, children))
    n = int(input('Enter any number to continue or -1 to end : '))

Output:


Related Solutions

Python code Financial Assistance : A non-governmental organization needs a program to calculate the amount of...
Python code Financial Assistance : A non-governmental organization needs a program to calculate the amount of financial assistance for needy families. The formula is as follows: • If the annual household income is between $30,000 and $40,000 and the household has at least three children, the amount is $1,000 per child. • If the annual household income is between $20,000 and $30,000 and the household has at least two children, the amount is $1,500 per child. • If the annual...
Think about two public goods – public schools and food assistance for needy families. Consider the...
Think about two public goods – public schools and food assistance for needy families. Consider the implications of the Tiebout model. Which of the goods is more efficiently provided locally? Which is more efficiently provided centrally? Explain
Temporary Assistance to Needy Families a)creates work incentives b)is an entitlement that offers cash to poor...
Temporary Assistance to Needy Families a)creates work incentives b)is an entitlement that offers cash to poor families c)has a 2 year time limit, and then work effort is required d)provides $1000 a month to recipients in California
Why is it difficult to define the term NGO? (Non Governmental Organization)
Why is it difficult to define the term NGO? (Non Governmental Organization)
prepare a 500 to 700 word letter to either a government institution or non governmental organization...
prepare a 500 to 700 word letter to either a government institution or non governmental organization of your choice describing the conditions you encountered on a recent visit to an underdeveloped country. In your letter request financial assistance and / or resources for an intervention in a selected area that you feel will have the most impact on population health
Question A non-governmental organization intends to carry out a programme which will involve distribution of clean...
Question A non-governmental organization intends to carry out a programme which will involve distribution of clean water, soap, sanitizers, face mask and food to across all informal settlements in Nairobi County during this coronavirus pandemic period. In view of this, conduct and a comprehensive stakeholder analysis (identifying only FIVE key stakeholders) the NGO will need to engage before commencing the programme.
A non-governmental organization (ngo) introduced to subsistence farmers a modern seed variety with potential to produce...
A non-governmental organization (ngo) introduced to subsistence farmers a modern seed variety with potential to produce ten times more yield than traditional seed varieties. The likelihood of crop failure using modern seeds was higher compared to traditional seeds. The NGO was surprised that the farmers were reluctant to adopt these modern seeds. Explain using risk and uncertainty why this economic behaviour by farmers is rational? What could be done to increase adoption of modern seed varieties by farmers? Short answer...
Think carefully about the overall mission and goals of a non-governmental organization(NGO), such as Doctors Without...
Think carefully about the overall mission and goals of a non-governmental organization(NGO), such as Doctors Without borders or The Nature Conservancy. Required: How does the task of building a balanced scorecard for an NGO differ from that for a profit-seeking enterprise? Choose an NGO that interests you and design a simple balanced scoreboard for them with a minimum of two measures in each of scorecard’s perspectives
Pretend you are a public affairs officer for a private business, non-profit organization or governmental agency....
Pretend you are a public affairs officer for a private business, non-profit organization or governmental agency. You have been asked to review messages from various organizations regarding changes in access, hours, services, or policies in response to COVID-19 pandemic and to recommend a set of writing standards and practices that your own company should follow when producing such communications. *Review and comment on this message. As a result of COVID-19, we are closed until further notice.   We apologize for the...
Write a function that implements the following formula to calculates the amount of financial assistance for...
Write a function that implements the following formula to calculates the amount of financial assistance for families in need: • If the annual family income is between $30,000 and $40,000 and the family has at least 3 children, the assistance amount will be $1,000 per child. • If the annual family income is between $20,000 and $30,000 and the family has at least 2 children, the assistance amount will be $1,500 per child. • If the annual family income is...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT