// Allison Obourn, CSE 142 // demonstrates two ways of rounding numbers to // two decimal places public class RoundingFun { public static void main(String[] args) { double gpa = 3.45268923115; System.out.printf("gpa: %.2f\n", gpa); System.out.println("gpa: " + round2(gpa)); } // rounds the given number to 2 decimal places public static double round2(double num) { return Math.round(num * 100) / 100.0; } }