Как найти максимальное значение набора переменных

Мне было интересно, может ли кто-нибудь помочь мне найти максимальное значение набора переменных и присвоить их другой переменной. Вот фрагмент моего кода, который может помочь понять, о чем я говорю.

// Ask for quarter values.
    System.out.println("What is the value of the first quarter?");
    firstQuarter = input.nextDouble();

    System.out.println("What is the value of the second quarter?");
    secondQuarter = input.nextDouble();

    System.out.println("What is the value of the third quarter?");
    thirdQuarter = input.nextDouble();

    System.out.println("What is the value of the fourth quarter?");
    fourthQuarter = input.nextDouble();

    //Tell client the maximum value/price of the stock during the year.     
    //maxStock = This is where I need help 
    System.out.println("The maximum price of a stock share in the year is: $" + maxStock + ".");
13
задан nybbler 16 February 2012 в 01:08
поделиться