Question: Exercise 21-Strings Using the given project Strings, complete each section in the class YourCode by using the methods specified in each exercise (you may declare
Exercise 21-Strings Using the given project Strings, complete each section in the class YourCode by using the methods specified in each exercise (you may declare additional variables). No need to askthe user to enter values; use the variables that are already declared in the method. The class Testing already has testing cases to test your code. You simply need to compile and execute either the main method oreach section of this class. Details about methods of the class String can be found in the String lecture slides. The method length0 requires no parameters and it returns the length of the string as an int. Folder name: A170 E21 Your LastName_YourFirstName Part A. HALF A STRING Given a string strl of even length, print out the first half. Methods to use substring0, length0 Testing cases: Woo Hello There Hello abcdef abc 0123456789 01234 Part B. WITHOUT ENDS Given a string strl print out the string without the first and last char. The string length is at least 2. Methods to use: substringl), length0 Testing Hello coding odin od (empty string) Chocolate ittee ex ooho
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
