From e5309b75c459dcfb0473c4670320fc8d6884bd43 Mon Sep 17 00:00:00 2001 From: Om Ugale <91754531+osugale@users.noreply.github.com> Date: Tue, 20 Jun 2023 01:57:37 +0530 Subject: [PATCH] Corrected Coding Exercise 5 - Decimal Comparator --- Coding Exercise 5 - Decimal Comparator | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Coding Exercise 5 - Decimal Comparator b/Coding Exercise 5 - Decimal Comparator index c749bac..558c5e7 100644 --- a/Coding Exercise 5 - Decimal Comparator +++ b/Coding Exercise 5 - Decimal Comparator @@ -1,8 +1,12 @@ public class DecimalComparator{ - public static boolean areEqualByThreeDecimalPlaces (double a,double b) { - if((int)a * == b1) - return true; - else - return false; + + public static boolean areEqualByThreeDecimalPlaces(double a, double b){ + + if ((int) (a*1000) == (int) (b*1000) ){ + return true; + } + else{ + return false; + } } }