如何找到变量集的最大值
我想知道是否有人可以帮助我找到一组变量的最大值并将其分配给另一个变量。这是我的代码片段,可能有助于理解我在说什么。
// 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 + ".");