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
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---