誰かが一組の変数の最大値を見いだし、別の変数に割り当てることができるかどうか疑問に思っていました。ここで私が話していることを理解するのに役立つかもしれないコードの抜粋です。変数の最大値を見つける方法
// 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 + ".");
私はこれを考えた謝罪ジャワのフォーラムの下にあったか、それに沿ったものでした。 –
@CodyBennett心配はいりません。私はあなたのためのJavaタグを追加しました。あなたが別の答えを探しているなら、それはもっと多くの反応を得る助けになるでしょう。 – nybbler
この解決方法は書かれているとおりに破損しています。 Double.MIN_VALUEは、 "double型の最小正のゼロ以外の値"を返します。これは0に非常に近い数値であり、可能な限り大きな負の倍数ではありません。代わりに、Double.NEGATIVE_INFINITYまたは-Double.MAX_VALUEのようなものを使用できます。 – ulmangt