My homework goes like this:
Write a program that accepts as many integers the user wants to input. Determine the highest and lowest numbers and subtract all other numbers from the highest number.
example: numbers to be entered: 6
number1 :15
number6: 42

Highest: 42
[The difference from the highest is:
[42-20]=22 <---how can i display them?

.. please help me.thanks

import java.util.*;

   public class HighestLowestDifference2324 {
    public static void main(String[] args) {
        Scanner input = new Scanner(;

        double maxValue = Double.MIN_VALUE;
        double minValue = Double.MAX_VALUE;  
        double minValue1 = Double.MAX_VALUE; 
        double minValue2 = Double.MAX_VALUE; 

        int count = 0;
          double difference = 0; 

        System.out.println("Enter numbers. Terminate with Q.");
        while (input.hasNextDouble()) { 

            double Value = input.nextDouble();

            if (Value > maxValue) {
                maxValue = Value;
            if (Value < minValue) {
                minValue = Value;
            if (Value < minValue) {
                minValue1 = Value; }
                if (minValue == minValue1)   {
                minValue = Value; }
            if (Value < minValue1) {
                minValue2 = Value; }
                if (minValue1 == minValue2)   {
                minValue1 = Value; }
                difference = maxValue-minValue;        
        if (count > 0) {                                          
            System.out.println("Highest no. is: "  + maxValue);
            System.out.println("Lowest no. is: "  + minValue);
                System.out.println("The difference from the highest is: \n" + difference);
           else {
            System.out.println("Have a good day!"); }

that is my code... pls. help me. I can't show all the differences that I want to display.

What exactly is your question? - the code you posted displays the results.

I have to get the difference of the highest number and the rest..
for example, to get the differences: 27,22,13,4,30. when i use the code , it only shows 27.

Logically you don't know the highest number until all the numbers have been input, so to show all the differences you will have to store all the numbers (eg in an array) as they are input. Then, when you know the largest, you can loop through the array and disaply all the differences.

so I have to change all my codes into an array?.. but is it possible that an array contains numbers yet
to be input ?

... only if you have time travel!
You start with an array that's big enough, fill in the data and keep track of how many data were entered ( = how many of the array elements have been used)

SIR JAMES... i'M SORRY FOR ASKING SILLY QUESTIONS ..xD. can you pls. add that to my code and show it off?...
i dont't know how to do array, eh?..please. ^_^ –