Logical Error Correction

This commit is contained in:
2022-06-10 10:41:30 +05:30
parent fb4c7ef02c
commit a6509debfd

View File

@@ -50,13 +50,17 @@ public class CompoundInterestCalculator{
r = (float) 6.5; r = (float) 6.5;
} }
// checks if age is less than 18 yr
if (age <= 18) { if (age <= 18) {
r = r + 1 ; 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); r = (float) (r + 1.5);
} }
// Input error check
else { else {
System.out.println("Error Wrong Age Input!"); System.out.println("Error Wrong Age Input!");
} }