this my answer for question 2(a) and (

for this lab. for ques 1 still working about it:
2(a)
CODE
package palindromes;
import java.util.Scanner;
/**
*
* @author Mohd Redzuan Omar
*/
public class CheckPalindrome {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter a string: ");
String str = scanner.next();
if(isPal(str))
{
System.out.println( str + " is a palindrome");
}
else
System.out.println( str + " is not a palindrome");
}
public static boolean isPal(String s)
{
return isPal(s,0,s.length()-1);
}
public static boolean isPal(String str, int startIndex, int endIndex)
{
if(endIndex <= startIndex )
{
}
else if(str.charAt(startIndex) != str.charAt(endIndex))
{
return false;
}
else
return isPal(str,startIndex+1,endIndex-1);
return true;
}
}
answer for 2(

CODE
package palindromes;
import java.util.Scanner;
/**
*
* @author Mohd Redzuan Omar
*/
public class CheckPalindromes {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String[] str = new String[5];
int i;
System.out.println("Enter a string: ");
for( i=0; i<str.length;i++)
{
str[i]=scanner.next();
if(isPal(str[i]))
{
System.out.println( str[i] + " is a palindrome\n");
}
else
System.out.println( str[i] + " is not a palindrome\n");
}
}
public static boolean isPal(String s)
{
return isPal(s,0,s.length()-1);
}
public static boolean isPal(String str, int startIndex, int endIndex)
{
if(endIndex <= startIndex )
{
}
else if(str.charAt(startIndex) != str.charAt(endIndex))
{
return false;
}
else
return isPal(str,startIndex+1,endIndex-1);
return true;
}
}
hey how to turn off the smiley face ? where i can turn it off