java吧 关注:1,233,515贴子:12,699,135
  • 9回复贴,共1

感觉没救了,只能来发帖求救了。

只看楼主收藏回复









1楼2014-11-17 11:57回复
    // Lab08vst.java
    // The "Palindrome" Program
    // This is the student starting file for Lab08.
    import java.util.Scanner; public class Lab08st{
    public static void main (String args[])
    {
    System.out.println("\nLab08v80\n");
    Scanner input = new Scanner(System.in);
    boolean notFinished = false;
    do
    { System.out.print("Enter a string ===>> ");
    String str = input.nextLine();
    System.out.println();
    System.out.println("Entered String: " + str);
    System.out.println("Palindrome: " + Palindrome.isPal(str));
    System.out.println("Almost Palindrome: " + Palindrome.almostPal(str));
    // used only for the 100 point version
    System.out.print("Do you wish to repeat this program [Y/N]? ===>> ");
    String repeat = input.nextLine();
    notFinished = (repeat.equals("Y")) || (repeat.equals("y"));
    System.out.println();
    }
    while (notFinished);
    }
    }
    class Palindrome
    {
    /* * Precondition: s is an arbitrary String.
    * Postcondition: The value of true is returned if s is a Palindrome, false otherwise.
    * Note:
    >>>>> This method is required for both the 80 point and the 100 point versions <<<<<
    */ public static boolean isPal(String s)
    {
    return true;
    // This statement is provided to allow initial compiling.
    }
    /* * Precondition: s is a String of one character.
    * Postcondition: The value of true is returned if s is a letter and false otherwise.
    * Note: >>>>> This method is only completed for the 100 point version <<<<<
    */ private static boolean isLetter(String letter)
    {
    return true;
    // This statement is provided to allow initial compiling. }
    /* * Precondition: s is an arbitrary String.
    * Postcondition: All non-letter characters are removed from s, and this "purged" String is returned.
    * Note: >>>>> This method is only completed for the 100 point version <<<<< */
    private static String purge(String s)
    {
    return "";
    // This statement is provided to allow initial compiling.
    }
    /* * Precondition: s is an arbitrary String.
    * Postcondition: After purging all non-letter characters from s,
    * the value of true is returned if the resulting String is a Palindrome, false otherwise.
    * Note: >>>>> This method is only completed for the 100 point version <<<<< */
    public static boolean almostPal(String s)
    {
    return true;
    // This statement is provided to allow initial compiling.
    }
    }


    2楼2014-11-17 12:00
    回复
      meiren me


      3楼2014-11-17 21:34
      回复
        498455115


        IP属地:法国5楼2014-11-17 22:13
        收起回复
          发这么多,谁又时间看,简短,精要


          IP属地:北京来自Android客户端6楼2014-11-18 07:16
          收起回复


            来自Android客户端7楼2014-11-18 07:33
            回复