# Arrays

• September 7th, 2011, 10:47 PM
ruffu054
Arrays
Code Java:

```import java.util.Scanner; public class Max_Number { public static void main(String[] args) { Scanner input = new Scanner(System.in);   double[] myList = new double[6];   double max = myList[0]; for (int i = 1; i < myList.length; i++) { if (myList[i] > max) max = myList[i];   System.out.print("Enter a number: "); myList[i] = input.nextDouble();   }     int countGreater = 0;   for (int i = 0; i <myList.length; i++) { if(myList[i] > max) countGreater++; }   System.out.println("The max is " + max); System.out.println("The number of values greater than the max is " + countGreater); } }```
• September 7th, 2011, 10:50 PM
Junky
Re: Arrays
With what?
• September 7th, 2011, 10:51 PM
Junky
Re: Arrays
Quote:

Originally Posted by ruffu054
computes the max and finds out how many numbers are above the max.

Simple. None!

How can you have any numbers greater than the max number?
• September 7th, 2011, 10:53 PM
ruffu054
Re: Arrays
Its not giving me the correct output when run the program.
• September 7th, 2011, 10:54 PM
ruffu054
Re: Arrays
I dont make up the problem I just try to do them
• September 7th, 2011, 10:59 PM
ruffu054
Re: Arrays
still confused?????????????
• September 7th, 2011, 11:18 PM
Junky
Re: Arrays
Then I suggest you seek clarification from your teacher. Given the numbers: 1 6 4 2, the largest number is 6 and there are no numbers bigger than 6. So the question does not make sense or you have misunderstood it.