public void showAverage(double mathGrade,double historyGrade,double
scienceGrade)
        {
                
                
                double average =((mathGrade+historyGrade+scienceGrade)/3.0);
                
                if(((Math.max(50, average))== average)&&((Math.min(91, 
average))== average))
                        {
                                System.out.println("Good work"+average);
                        }
        }

On Mon, Dec 19, 2011 at 4:08 PM, Tapasa Samanta <[email protected]> wrote:
> public Double showAverage(double mathGrade,double historyGrade,double
> scienceGrade)
>        {
>                return ((mathGrade+historyGrade+scienceGrade)/3.0);
>        }
>
> On Mon, Dec 19, 2011 at 1:59 PM, Neville Agius <[email protected]> wrote:
>> else if ( (average ==  50).... and not else if ( (average = 50) since in
>> java == is a logical operator while = is an assignment operator
>>
>> Neville
>>
>> On 18 December 2011 19:00, [email protected] <[email protected]> wrote:
>>>
>>> Hello Team,
>>>
>>> Not sure whether I post this message in the correct group, sorry.
>>>
>>> I am trying to complete the LAB-1034 "4. (For your own exercise....),
>>> * If the average is greater than 50 (average > 50) and less than or
>>> equal  to 90 (average <= 90), display "You did OK! Your average is xx.
>>> 0."
>>>
>>> I have certainly made an error on using the criteria decribed on page
>>> 20 "Sample Program".
>>>
>>> ==============================
>>>  // Compute average
>>>        average = (mathGrade+historyGrade+scienceGrade)/3;
>>>
>>>        // Perform if & else control
>>>        if (average >= 60){
>>>            JOptionPane.showMessageDialog(null, "Good job! Your
>>> average is " + average);
>>>        }
>>>
>>>        else if ( (average = 50) && (average <=90)) {
>>>            JOptionPane.showMessageDialog(null, "You did good! Your
>>> average is " + average);
>>>
>>>        }
>>> =============================
>>>
>>> Any idea what's wrong?
>>> Thanks.
>>> Regards
>>>
>>> Salvatore
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "JPassion.com: Java Programming" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group at
>>> http://groups.google.com/group/jpassion_java?hl=en.
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "JPassion.com: Java Programming" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/jpassion_java?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"JPassion.com: Java Programming" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jpassion_java?hl=en.

Reply via email to