मैं सोच रहा था कि कोई मुझे चर के सेट के अधिकतम मूल्य को खोजने में मदद कर सकता है और उन्हें किसी अन्य चर को असाइन कर सकता है। यहां मेरे कोड का एक स्निपेट है जो समझने में मदद कर सकता है कि मैं किस बारे में बात कर रहा हूं।चर के सेट का अधिकतम मूल्य कैसे खोजें
// 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 + ".");
मैं माफी माँगता हूँ मैं इस बारे में सोचा जावा फोरम या उन पंक्तियों के साथ कुछ था। –
@ कोडीबेनेट कोई चिंता नहीं। मैंने आपके लिए जावा टैग जोड़ा है।यदि आप एक अलग उत्तर की तलाश में हैं तो इससे अधिक प्रतिक्रियाएं मिल सकती हैं। – nybbler
यह समाधान लिखित के रूप में टूटा हुआ है। Double.MIN_VALUE "टाइप डबल का सबसे छोटा सकारात्मक nonzero मान" देता है, जो 0 के बहुत करीब है, न कि सबसे बड़ा संभव नकारात्मक डबल। इसके बजाय, Double.NEGATIVE_INFINITY या -Double.MAX_VALUE जैसे कुछ का उपयोग किया जा सकता है। – ulmangt