Guest User

Untitled

a guest
Jan 23rd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. mport java.util.Scanner;
  2.  
  3. public class ZiolkowskiKyleA2Q2 {
  4.  
  5. public static void main(String[] args)
  6. {
  7.  
  8. //declare variables
  9. //String input; // to store the users input
  10. String input;
  11. int first;
  12. int last;
  13. char charFirst; // to store the first char
  14. char charLast; // to store the last char
  15.  
  16. Scanner kbd = new Scanner(System.in);
  17.  
  18.  
  19.  
  20. System.out.println("Enter in a palindrome of your choice");
  21. input = kbd.nextLine();
  22.  
  23. first = 0;
  24. last = input.length() -1;
  25.  
  26.  
  27.  
  28. while (first < last) {
  29.  
  30. charFirst = input.charAt(first);
  31. charLast = input.charAt(first);
  32.  
  33.  
  34. if (charFirst == charLast) {
  35.  
  36. System.out.println(input + " : is a palindrome");
  37.  
  38. }
  39. else {
  40.  
  41. System.out.println(input + " :is not a palindrome");
  42.  
  43. }
  44.  
  45.  
  46.  
  47. System.out.println("***End of Programming***");
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57. }
  58. }
  59. }
Add Comment
Please, Sign In to add comment