From a6509debfdc11f4b756cf4bc6fc0dde71eb9a0d0 Mon Sep 17 00:00:00 2001 From: psavarmattas Date: Fri, 10 Jun 2022 10:41:30 +0530 Subject: [PATCH] Logical Error Correction --- .../CompoundInterestCalculator.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/IndustrialTrainingProjects/CompoundInterestCalculator.java b/IndustrialTrainingProjects/CompoundInterestCalculator.java index 65b9dca..fb83590 100644 --- a/IndustrialTrainingProjects/CompoundInterestCalculator.java +++ b/IndustrialTrainingProjects/CompoundInterestCalculator.java @@ -50,13 +50,17 @@ public class CompoundInterestCalculator{ r = (float) 6.5; } - + // checks if age is less than 18 yr if (age <= 18) { r = r + 1 ; } - else if (age <= 60) { + + // checks if age is greater than 18 yr and is less than 60 yr + else if ((age > 18) && (age <= 60)) { r = (float) (r + 1.5); } + + // Input error check else { System.out.println("Error Wrong Age Input!"); }