Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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 household income is less than $20,000, the amount is $2,000 per child.

Implement a method for the above computation.

Write a program named P8_IncomeAssist that asks for the household income and then asks for the number of children for each applicant. Print the amount returned by the calculation method. Allow for multiple iterations and use -1 as the sentinel value for the input. When -1 is entered: Exit the program and print a message.

Sample input : Enter household income or -1 to exit:

Number of children:

Your tester program (main) will:

Start execution

Gather input from the keyboard

Call your method(s)

Print output

Your method(s) will:

Do the work of calculations

Return a value to the caller

Sample output:

Enter household income or -1 to exit: 90000

Number of children: 3

Based upon a household income of $ 90000.0 and 3 children,

the income assistance amount is 0.0

Enter household income or -1 to exit: -1

Exiting the program.

Enter household income or -1 to exit: 10000

Number of children: 3

Based upon a household income of $ 10000.0 and 3 children,

the income assistance amount is 6000.0

Enter household income or -1 to exit: 30000

Number of children: 3

Based upon a household income of $ 30000.0 and 3 children,

the income assistance amount is 4500.0

Enter household income or -1 to exit: -1

Exiting the program.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 Universal Database V7.1 Application Development Certification Guide

Authors: Steve Sanyal, David Martineau, Kevin Gashyna, Michael Kyprianou

1st Edition

0130913677, 978-0130913678

More Books

Students also viewed these Databases questions