Question
specs for StringMethods Write a public class call StringMethods with a main method. what it does: 0. prompt user for a String 1. prompt user
specs for StringMethods
Write a public class call StringMethods with a main method. what it does: 0. prompt user for a String 1. prompt user for an int 2. if integer is greater or equal than 10 go back to step 0 3. if integer is 0 end program 4. if String starts with 0, end program 5. if integer is between 1 and 10 (inclusive) perform the operation and print the message that matches the examples below Restrictions: do not use anything we haven't covered in class.
Examples
% java StringMethods enter a string (end with 0): abcABC123 enter an int (end with 0): 1 upper case: ABCABC123 enter a string (end with 0): abcABC123 enter an int (end with 0): 2 lower case: abcabc123 enter a string (end with 0): abcABC123 enter an int (end with 0): 3 replace all a's by "foo": foobcABC123 enter a string (end with 0): abcABC123 enter an int (end with 0): 4 a b c A B C 1 2 3 enter a string (end with 0): abcABC123 enter an int (end with 0): 5 first: a last: 3 enter a string (end with 0): abcABC123 enter an int (end with 0): 6 it doesn't contain 'z' enter a string (end with 0): abcABC123 enter an int (end with 0): 7 reverse: 321CBAcba enter a string (end with 0): 8 enter an int (end with 0): 8 string is too short enter a string (end with 0): abcABC123 enter an int (end with 0): 8 substring from 3rd character to end: cABC123 enter a string (end with 0): a enter an int (end with 0): 9 string is too short enter a string (end with 0): abcABC123 enter an int (end with 0): 9 substring from 2nd character to 4th (inclusive): bcA enter a string (end with 0): a enter an int (end with 0): 10 'z' does not appear in second half enter a string (end with 0): abcABC1z23 enter an int (end with 0): 10 'z' appears in second half enter a string (end with 0): aazaa enter an int (end with 0): 10 'z' does not appear in second half enter a string (end with 0): abc enter an int (end with 0): 11 enter a string (end with 0): 0 %
Step 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