Question
import java.util.*; public class CountFamilies { public static Scanner kbd; public static void main(String[] args) { kbd = new Scanner(System.in); kbd.close(); } /** * Finds
import java.util.*;
public class CountFamilies { public static Scanner kbd; public static void main(String[] args) {
kbd = new Scanner(System.in); kbd.close(); } /** * Finds the maximum integer in an array of integers * @param values The array containing the list of integers to search * @return The largest integer found in the array */ public static int getMaximum(int [] values) { return 0; } }
(Here is the starter code)
Write a program that counts the number of families whose income is below a certain level.
Begin your program by asking the user to enter the number of families. Store this value in a variable callednumOfFamilies.
Next, create an array whose size is numOfFamilies. After the array has been created, readnumOfFamiliesvalues, representing family incomes, from the keyboard and place them into the array.
Next, find the maximum income of all the values entered, and print this value to the screen.
Finally, count the families that make less than 10% of the maximum income. Display the income of each of these families, then display the count. Make sure you use correct grammar (i.e. 1 family, 2 families).
The following is an example of what your MIGHT see on the screen when your program runs. The exact output depends on what values that the user types in while the program runs. The user's values are shown below in italics:
Please enter the number of families: 5 Enter an income: 8500 Enter an income: 109000 Enter an income: 49000 Enter an income: 9000 Enter an income: 67000 The maximum income is: 109000 The incomes of families making less than 10% of the maximum are: 8500 9000 for a total of 2 families
(Another example is)
Please enter the number of families: Enter an income: Enter an income: Enter an income: The maximum income is: 275000 The incomes of families making less than 10% of the maximum are: 12000 for a total of 1 family
Program Requirements
You must create and use a method named getMaximum. This method should receive one parameter, which is an array of integers. This method should search the array of integers to find and return the largest number in the list.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started