Ups, forgot to CC the group.

Repost:

Hi guys,

Sorry but I don't get it. Merouen, as I understand your question, when
you print (display) the double value 'average', either you only see
the integer part (before the decimal seperator), or you think you
won't see the rest.

If the 'average' variable is a double, displaying it with
System.out.println will show both the integer and the decimal part
automatically, so there should be no problem here.

On Sun, Jul 19, 2009 at 7:54 PM, Juan Hdz.<[email protected]> wrote:
>
> divide average by 3.0
> then you can use the static String.format() method:
>
> average = (mathGrade + historyGrade + scienceGrade) / 3.0;
> System.out.println(String.format("%.2f", average));
>
>
> On Jul 18, 4:41 pm, Merouen Ballout <[email protected]> wrote:
>> as example code 1.11 the average is declared like  primitive type
>> double so in the output it should be double , so what's method can be
>> used in order to  to display after point?
>>
>> thanks
>
> >
>



-- 
Diogo Sales Oliveira

--~--~---------~--~----~------------~-------~--~----~
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/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to