Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(I already open the file put all the screenshot below. please do the highlighted part in the assignment detail below. (or send me your email
(I already open the file put all the screenshot below. please do the highlighted part in the assignment detail below. (or send me your email so i can send you the actual file.)
description Please download this zipped Eclipse project. Unzip the project, and import it into Eclipse by choosing File -> Import -> Existing Projects into Workspace. Open the project and its included source file SomePracticeMlethods.java. You'll find that it contains several methods that have not yet been finished. For now, the methods contain only a placeholder return value so that the code will compile. Fill in your own implementation Do not modify any other files in the project. You do not have to write a main() to test your code. Though it may not be obvious, all of the test code has been written for you. If you're curious, you can find it by looking at the file somePracticeStringMethodsTest.java included in the same directory as the code you need to complete. These tests use the popular JUnit testing framework. For now, you are not required to understand how they work. If you're curious, by all means look, but please do not modify the contents of this file In order to test your methods using the provided tests, click on the SomePracticeStringMethodsTest.java file, and the click the run button. Initially, you'll see a red bar, indicating that not all of the tests have passed. Each of your functions whose tests did not pass will have an X through its name. Eventually you'll have perfectly debugged code, and the bar will turn green It's highly recommended that you use short helper methods to help program other methods. For example, you might use your inTU) method in the more complicated methods involving letters in the word Temple Similarly you might consider using the reversed() method from this assignment in your your sameInReverse() method what to submit There are two options: because you're only modifying somePracticeMethods.java, you may submit just this, or you can upload a zip of your entire modified Eclipse project directory. Please send your work through Canvas SomePracticeStringMethods.java 3 1 package stringPractice1068; 2 3 public class SomePracticeStringMethods [ 4e returns true if cis a letter in the word "temple" or false otherwise 6 7 public static boolean inTU(char c) t /* placeholder just so that the function 8 9 10 *compiles. fill in your implementation here *there is a similar placeholder *for each of the remaining functions */ 12 return true; 14 17 returns the index of the first occurrence of in s *of a letter in the word "temple" or 1 if s contains no letters in the word "temple" 20 21e public static int indexofFirstTULetter (String s) return-1; 23 25e /* 26 27 28 29 returns the index of the first occurrence of a letter in "temple" in s starting from index startPosition or -1 if there are none at index startPosition or later. Notice that this method has the same name as the *previous one, but that it takes a different number of arguments. This is *perfectly legal in Java. It's called "method overloading" SomePracticeStringMethods.java 3 32e public static int indexofFirstTULetter(String s, int startPosition) return-1; 34 35 36 /* 37 38 39 40 * returns the index of the last occurrence of a letter in the word "temple" * in s or -1 if s * contains none 41 public static int indexOfLastTULetter(String s) 42 43 return-1; 45 46 /* returns true if every letter in s is a letter * in the word "temple" or false otherwise */ 47 public static boolean allTempleLetters(String s) { 48 49 50 51 returns true if no letter in sis a letter 52 return true: in the word "temple" or false otherwise*/ 53 public static boolean noTempleLetters (String s) 54 return true; 56 58 59 60 61 * returns a new String which is the same as s, but with all of the letters * in the word "temple" removed public static String withoutTULetters (String s) f SomePracticeStringMethods.java 3 63 64 65e * returns s in reverse. For example, if s is "Temple", the method returns the " String "elpmeT 67 68 69 public static String reversed(String s) { 70 71 72 73 1* 74 return "ADD ME" returns the number of times that n occurs in h. For example, if h is *"Mississippi" and n is "SS" the method returns 2 76 77 public static int numOccurrences (String h, String n) { 78 79 80 81e * 82 83 84 public static boolean sameIn(String s) 85 86 87 return 0; *returns true if s is the same backwards and forwards and false otherwise return true; 89e * 90 91 92 * Returns a new String that looks like base appended with suffix. If base * already ends with suffix, it returns base 92 93 94 95 96 97 For example, if base is "lightning" and suffix is "bug", returns If base is "lightningbug" and suffix is "bug", it also returns 98 , Sitningbug" 99 public static String appendIfMissing(String base, String suffix) 100 101 102 return "ADD MEStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started