A02

Due Date: Friday, 22 January 2021
File(s) to be submitted: PovertyData.java
Sample Output: SampleOutput.html


SUBMIT   /   Check

Poverty Data (imperative programming including methods and arrays)

Summary

Your task is to create a program class that reads some income data then prints a report on poverty rates.

Your program uses an array to keep track of the incomes of multiple families. It also uses various methods to calculate statistics for those families.

For an introduction to measuring poverty, see the Wikipedia page.

Watch a video about this assignment on YouTube. Or get it from the course website.

Details

  1. Your program starts by printing out a program identification and self-description, and then pauses.
    Poverty Rate Program
    --------------------
    
    This program reads data on family incomes and produces a report on poverty
    rates among the families.  
    
    By Mark Young (A00000000)
    Winter, 2021
    
    ...press enter...
    
  2. Your program then asks the user to enter family income data.
    How many families are there in this country? 5
    
    What is the income for family #1? 5000
    What is the income for family #2? 15000
    What is the income for family #3? 35000
    What is the income for family #4? 55000
    What is the income for family #5? 95000
    
    There must be at least two families in the country, and each income must be non-negative (that is, zero is allowed as an income). If invalid data is entered, the program requests a replacement.
  3. Next your program reads the "basic needs income" -- the amount of income that's required to cover their basic needs -- that is, to keep them out of absolute poverty.
    What is the minimum income required to support a family? 10000
    
    Once again, the income must be non-negative. If invalid data is entered, the method requests a replacement.
  4. The program then pauses, asking the user to press the enter key.
  5. After the user presses the enter key, the program prints its report.
    Report
    ------
    
    Average Income:        $41000.0
    Basic Needs Income:    $10000.0
    Absolute Poverty Rate:  20.0%
    
    Median Income:         $35000.0
    Relative Needs Income: $21000.0
    Relative Poverty Rate:  40.0%
    
    The report has a title and two sections.

    The first section is for the absolute poverty rate. It shows the average income for the families, the basic needs income, and the percent of families with income less than the basic needs income. (In this example only family #1 had an income less than $10000, and so the absolute poverty rate is 1 in 5, or 20%.)

    The second section is for the relative poverty rate. It shows the median income for the families, the relative needs income, and the percent of families with income less than the relative needs income. (In this example two families has less than $21000 income, so the relative poverty rate is 2 in 5, or 40%.)

  6. After printing the report, the program pauses again, prompting the user to press the enter key. The program ends after the user presses the enter key.

Your program uses methods as follows:

Some methods will be called more than once.

Each method must be given all the information it needs to do its job. (For example, the method to calculate the average income needs to be given the array containing all the incomes.) Methods for calculating must return the calculated values, not print them.

Notes

Grading Outline

Your assignment will be graded out of 100. Yes, that is well over 100 points of possible deductions. Doing half the job is not going to get you have the credit. You need to do good work as a matter of course; only excellent work will get full credit.
SUBMIT   /   Check