diff --git a/hackerrank/Day4.java b/hackerrank/Day4.java index c6e79f7..6269d99 100644 --- a/hackerrank/Day4.java +++ b/hackerrank/Day4.java @@ -2,28 +2,28 @@ import java.util.*; public class Day4 { - private int age; + private int a; public Day4(int initialAge) { // Add some more code to run some checks on initialAge if(initialAge<0){ System.out.println("Age is not valid, setting age to 0."); - age = 0; + a = 0; } else{ - age = initialAge; + a = initialAge; } } public void amIOld() { // Write code determining if this person's age is old and print the correct statement: - if(age<13){ + if(a<13){ System.out.println("You are young."); } - else if(age>=13 && age<18 ){ + else if(a>=13 && a<=19 ){ System.out.println("You are a teenager."); } else{ @@ -33,7 +33,7 @@ else if(age>=13 && age<18 ){ public void yearPasses() { // Increment this person's age. - age = age + 1; + a = a + 1; } public static void main(String[] args) { @@ -51,4 +51,4 @@ public static void main(String[] args) { } sc.close(); } -} \ No newline at end of file +}