From e045d5596408f9bfe2c7e97e23110aefcfa6681e Mon Sep 17 00:00:00 2001 From: annazineldin3 Date: Tue, 18 Aug 2026 14:02:26 +0200 Subject: [PATCH] completed --- .../java/com/booleanuk/core/Exercise.java | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/booleanuk/core/Exercise.java b/src/main/java/com/booleanuk/core/Exercise.java index 8125ead..157e0e4 100644 --- a/src/main/java/com/booleanuk/core/Exercise.java +++ b/src/main/java/com/booleanuk/core/Exercise.java @@ -1,6 +1,8 @@ package com.booleanuk.core; import com.booleanuk.helpers.ExerciseBase; +import java.util.Locale; + public class Exercise extends ExerciseBase { public int numOne = 8; public int numTwo = 16; @@ -8,44 +10,49 @@ public class Exercise extends ExerciseBase { // 1. Change the value of the member below to be the result of adding numOne and numTwo together - public int numOnePlusTwo = 0; + public int numOnePlusTwo = numOne + numTwo; // 2. Change the value of the member below to be the result of multiplying numThree by numTwo - public int numThreeTimesNumTwo = 0; + public int numThreeTimesNumTwo = numThree * numTwo; // 3. Change the value of the member below to be the result of dividing numThree by numOne - public int numThreeDividedByNumOne = 0; + public int numThreeDividedByNumOne = numThree/numOne; // 4. Change the value of the member below to be the result of subtracting numOne from numThree - public int numThreeMinusNumOne = 0; + public int numThreeMinusNumOne = numThree - numOne; // 5. Change the value of the member below to be the sum of numOne, numTwo and numThree - public int sum = 0; + public int sum = numOne + numTwo + numThree; // 6. Change the value of the member below to be the sum of numOne, numTwo and numThree divided by numOne - public int numBytes = 0; + public int numBytes = ((numOne + numTwo + numThree)/numOne); // 7. Create a public char member named lastLetter containing the last letter of the English alphabet - +public char lastLetter = 'Z'; // 8. Create a public float member named pi that contains the value of pi to two decimal places - +public float pi = 3.14f; // 9. Create a public double member named piD that contains the value of pi to 5 decimal places - + public double piD = 3.14159; public String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; public String firstName = "Jane"; - public String lastName = "Smith"; + public String lastName = " Smith"; + public String fullName = firstName + lastName; + public char tenthLetter = alphabet.charAt(9); + public String lowerAlphabet = alphabet.toLowerCase(Locale.ROOT); + public int alphabetLength = alphabet.length(); + public int remainder = 15 % 8; // 10. Create a public member named fullName that contains the value of firstName and lastName concatenated together with a space in between