Write a program in a class CountPoor that counts the number of families that are considered poor. Write and use a class Family that has the attributes

• income—a double value that is the income for the family
• size—the number of people in the family and the following methods:
• Family(income, size)—a constructor that sets the attributes
• isPoor(housingCost, foodCost)—a method that returns true if housingCost + foodCost * size is greater than half the family income (foodCost is the average food cost for an individual, while housingCost is for the family)
• toString—a method that returns a string containing the information about
the family The program should read an integer k from the keyboard and then create an array of size k whose base type is Family. It should then create k objects of type Family and put them in the array, reading the income and size for each family from the keyboard. After reading an average housing cost and average food cost from the keyboard, it should display the families that are poor.


See the code in Family.java and CountPoor.java.

Computer Science & Information Technology

You might also like to view...

The ________ function returns one value if a condition is true and another if a condition is false

Fill in the blank(s) with correct word

Computer Science & Information Technology

Stack smashing is the only kind of buffer overflow attacks

Indicate whether the statement is true or false.

Computer Science & Information Technology

To client computers, the printer ________appears as though it were a single printer

Fill in the blank(s) with correct word

Computer Science & Information Technology

Describe palm print and hand geometry recognition.Palm print recognition is a biometric modality that uses the physical structure of an individual's palm print for recognition purposes; hand geometry recognition uses the physical structure of an individual's hand for recognition purposes.PTS:      1            REF: 394. Describe the mechanics of a retinal scan.

What will be an ideal response?

Computer Science & Information Technology