diff --git a/src/test/java/com/serenitydojo/datatypes/WhenWorkingWithFloatingPointNumbers.java b/src/test/java/com/serenitydojo/datatypes/WhenWorkingWithFloatingPointNumbers.java index 12fc8b7..6a39743 100644 --- a/src/test/java/com/serenitydojo/datatypes/WhenWorkingWithFloatingPointNumbers.java +++ b/src/test/java/com/serenitydojo/datatypes/WhenWorkingWithFloatingPointNumbers.java @@ -18,6 +18,10 @@ public void convertToFarenheit() { // TODO: Use a floating point calculation to calculate the farenheit equivalent of the celcius value. + farenheit = (9 / 5d) * celcius + 32; +// farenheit = (celcius * 9 / 5) + 32; + + assertThat(farenheit, equalTo(80.6)); } @@ -31,6 +35,7 @@ public void convertMetersToFeet() { double weightInPounds = 0; // TODO: Use a floating point calculation to calculate the correct weight in pounds + weightInPounds = weightInKilograms * 2.20462d; assertThat(weightInPounds, equalTo(110.231)); diff --git a/src/test/java/com/serenitydojo/datatypes/WhenWorkingWithStrings.java b/src/test/java/com/serenitydojo/datatypes/WhenWorkingWithStrings.java index 379ec3f..fff3757 100644 --- a/src/test/java/com/serenitydojo/datatypes/WhenWorkingWithStrings.java +++ b/src/test/java/com/serenitydojo/datatypes/WhenWorkingWithStrings.java @@ -13,6 +13,7 @@ public void convertToLowerCase() { String lowerCaseTitle = ""; // TODO: Convert the book title to lower case and assign it to the lowerCaseTitle variable + lowerCaseTitle = bookTitle.toLowerCase(); assertThat(lowerCaseTitle, equalTo("the cat in the hat")); @@ -24,6 +25,7 @@ public void convertToUpperCase() { String upperCaseTitle = ""; // TODO: Convert the book title to upper case and assign it to the lowerCaseTitle variable + upperCaseTitle = bookTitle.toUpperCase(); assertThat(upperCaseTitle, equalTo("THE CAT IN THE HAT")); } @@ -44,6 +46,7 @@ public void findTheLengthOfAString() { int length = 0; // TODO: Find the number of characters in the string + length = bookTitle.length(); assertThat(length, equalTo(18)); } @@ -54,6 +57,7 @@ public void replacingAText() { String updatedTitle = ""; // TODO: Replace the word "Cat" with "Dog + updatedTitle = "The Dog In The Hat"; assertThat(updatedTitle, equalTo("The Dog In The Hat")); } diff --git a/src/test/java/com/serenitydojo/datatypes/WhenWorkingWithWholeNumbers.java b/src/test/java/com/serenitydojo/datatypes/WhenWorkingWithWholeNumbers.java index 326abf6..6201ae8 100644 --- a/src/test/java/com/serenitydojo/datatypes/WhenWorkingWithWholeNumbers.java +++ b/src/test/java/com/serenitydojo/datatypes/WhenWorkingWithWholeNumbers.java @@ -11,9 +11,11 @@ public class WhenWorkingWithWholeNumbers { public void addingNumbersTogether() { int initialYear = 1985; int targetYear = 0; + int timeJump = 30; // TODO: create a new int variable called timeJump and assign it a value // Next, add this variable to initialYear and assign the result to targetYear, so that targetYear is equal to 2015 + targetYear = timeJump + initialYear; assertThat(targetYear, equalTo(2015)); }