diff --git a/src/main/java/com/booleanuk/core/Exercise.java b/src/main/java/com/booleanuk/core/Exercise.java index 7987028..d90fca8 100644 --- a/src/main/java/com/booleanuk/core/Exercise.java +++ b/src/main/java/com/booleanuk/core/Exercise.java @@ -17,6 +17,8 @@ public class Exercise extends ExerciseBase { The above assumes that the MyClass class has a constructor that defines a single parameter: a String. */ + + public Exercise(String name) { // A constructor must always be named exactly the same as the class name. This is the constructor for the // Exercise class, which accepts one string parameter. @@ -51,20 +53,28 @@ public Exercise(int age) { Create a constructor that accepts both a String and an int as parameters, in that order, and assign the values provided to the name and age members */ + public Exercise(String name, int age){ + this.age = age; + this.name = name; + } /* 2. Create a method named add that accepts two integers. The method should return the numbers added together. */ - + public int add(int num1, int num2) { + return num1+num2; + } /* 3. Create another method named add that accepts two Strings. The method should return the strings concatenated together with a space in between. */ - + public String add(String s1, String s2){ + return s1+" "+s2; + } }