# Tutor profile: Thi N.

## Questions

### Subject: Java Programming

Write a recursive method to reverse a string. Implement this method by taking the first letter of the string, reversing the remaining text, and combining the two.

Remember that a recursive method is a method that calls itself. Let's say the method name is reverseRecurse. The recursive method will be in this form: public String reverseRecurse (String s ) { if ( ) { //base case } else { //recursive case } } First, we must decide the base case (a case where the method returns the String and stop calling itself) of the recursive method. The method should not call itself if the length of the string is 1 or 0 characters because the reversed version will look the same so the base case is s.legnth()<=1. The method now looks like this with the base case: public String reverseRecurse (String s ) { if (s.length()<=1) { return s; } else { } } Second, we must determine the recursive case. If the string is longer than 1 character, we will move the first letter of the string to the end of it and pass it into the method. The final method looks like this: public String reverseRecurse (String s ) { if (s.length()<=1) { return s; } else { //s.substring(1) is the string without the first character //s.substring(0,1) is the first letter of the string return reverseRecurse (s.substring(1)) + s.substring (0,1); //moves the first character to the end and passes it into the method } }

### Subject: Basic Math

Solve $$\dfrac{2}{13} + \dfrac{5}{26}$$.

Note: -Denominator is the bottom number of a fraction -Numerator is the top number of a fraction. - Least common denominator is the lowest common multiple of the fractions. Remember that fractions can only be added if they have the same denominator. Since 13 an 16 are not the same, we must change the denominators. To do this: First, we must find the least common denominator between the two fractions. In this problem, the Least common denominator is 26. Second, make the denominators equal to each other. Since $$13\times 2=26$$, multiply top and bottom of the first fraction by 2. $$\dfrac{2}{2} \times\dfrac{2}{13} = \dfrac{4}{26}$$. Third, add the fractions by adding the numerators. Remember that the denominator does not change. $$\dfrac{4}{26} + \dfrac{5}{26} = \dfrac{9}{26} $$.

### Subject: Algebra

Solve the following quadratic equation by factoring: $$x^2+11x+10=0$$

Remember that quadratic equations are in the form $$ax^2+bx+c$$. So for this equation, a = 1, b = 11, c = 10. I will be showing you how to factor this using the "X-box method", also known as the "diamond method." First, draw an X. $$\times$$ Second, write b in the top portion of the X and write the product of a and c in the bottom portion of the X. So the X now looks like this 11 $$\times$$ 10 Third, find two numbers whose sum is 11 and the product is 10. For this problem, the two numbers are 10 and 1. $$10 + 1 = 11$$ $$10 \times 1 = 10$$ We put 10 and 1 on the left and right side of the x. 11 10 $$\times$$ 1 10 Fourth, write the factored equation in this form: $$ (x + 10)(x+1) = 0$$ Fifth, solve for x. $$x+10=0$$ $$x=0-10$$ $$x=-10$$ $$x+1=0$$ $$x=0-1$$ $$x=-1$$ So the answer is: x = -10 x = -1

## Contact tutor

needs and Thi will reply soon.