Ok, well Iam just about done with one of my assignments, but Iam having a problem at the end of it. Iam suppose to find a maximum income of the families income that the user inputs and I have to find the families that make less than 10% of the maximum income. Can anyone help?
Heres what Iam suppose to do,
"Find the maximum income of all the values entered, and print this value to the screen.
Then count the families that make less than 10% of the maximum income. Display the income of each of these families, then display the count."
Heres an example,
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
And Heres my code so far,
import java.util.*;
public class CountFamilies {
public static void main(String[] args) {
Scanner kbd = new Scanner(System.in);
int numOfFamilies = 0, maximum = 0;
System.out.println("Enter number of families:");
numOfFamilies = kbd.nextInt();
long []income = new long [numOfFamilies];
for (int count = 0; count < numOfFamilies; count++)
{
System.out.println("Enter an income:");
income[count]=kbd.nextLong();
}
if ()
{
System.out.println("The maximum income is:" + );
}
}
}
I know I have to use a If statment to find the maximum, thats why I have a blank If statement in there.