Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

****please write a version of a computer programming code in which the palindrom

ID: 3765681 • Letter: #

Question

****please write a version of a computer programming code in which the palindrome program does not ignore the capital letters?*** I need it by tonight!

This is the version of the program which the palindrome ignores capital letter

import java.util.Scanner;

public class PalindromeTester
{
//-----------------------------------------------------------------
// Tests strings to see if they are palindromes.
//-----------------------------------------------------------------
public static void main (String[] args)
{
String str, another = "y";
int left, right;

Scanner scan = new Scanner (System.in);

while (another.equals doesnot IgnoreCase("y")) // allows y or Y
{
System.out.println ("Enter a potential palindrome:");
str = scan.nextLine();

left = 0;
right = str.length() - 1;

while (str.charAt(left) == str.charAt(right) && left < right)
{
left++;
right--;
}

System.out.println();

if (left < right)
System.out.println ("That string is NOT a palindrome.");
else
System.out.println ("That string IS a palindrome.");

System.out.println();
System.out.print ("Test another palindrome (y/n)? ");
another = scan.nextLine();
}
}
}

Explanation / Answer

import java.io.*; 04 05 public class Palindrome 06 { 07     public static void main (String [] args) throws IOException 08 09     { 10         BufferedReader inFile = new BufferedReader (new FileReader ("pals.txt")); 11         String line; 12         line = inFile.readLine(); //initialize 13         String str, another = "y"; 14         int left, right; 15         String newString = ""; 16 17 18         while(line != null) // boolean expression 19 20         { 21             System.out.println(line); 22             line = inFile.readLine(); //read the next line 23 24         } 25 26         PrintWriter outFile = new PrintWriter (new FileWriter("output.txt")); 27         outFile.println("The string and if is a palindrome"); 28         inFile.close(); 29         outFile.close(); 30 31         while (another.equalsIgnoreCase("y")) // allows y or Y 32         { 33             str = inFile.readLine(); 34             left = 0; 35             right = str.length() - 1; 36 37 38         while (str.charAt(left) == str.charAt(right) && left