Skip to content

Commit

Permalink
second exercise
Browse files Browse the repository at this point in the history
  • Loading branch information
gokeoladel committed Dec 17, 2024
1 parent 9a31ce5 commit abfa355
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand All @@ -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));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"));

Expand All @@ -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"));
}
Expand All @@ -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));
}
Expand All @@ -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"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down

0 comments on commit abfa355

Please sign in to comment.