From ccadee21bcb743bf43e093bf514f2d6ffe449cfc Mon Sep 17 00:00:00 2001 From: Lowe Raivio Date: Tue, 7 Jan 2025 15:57:14 +0100 Subject: [PATCH] all test pass --- src/main/java/com/booleanuk/core/Exercise.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/com/booleanuk/core/Exercise.java b/src/main/java/com/booleanuk/core/Exercise.java index 7987028..cab4ba5 100644 --- a/src/main/java/com/booleanuk/core/Exercise.java +++ b/src/main/java/com/booleanuk/core/Exercise.java @@ -51,12 +51,20 @@ 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.name = name; + this.age = age; + } /* 2. Create a method named add that accepts two integers. The method should return the numbers added together. */ + public int add(int a, int b){ + return a + b; + } @@ -65,6 +73,10 @@ public Exercise(int age) { together with a space in between. */ + public String add(String a, String b){ + return a + " " + b; // String.format would look nicer... + } + }