Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java, pls use loop and strings Write a public class call StringMethods with a main method. what it does: 0. prompt user for a String

Java, pls use loop and strings Write a public class call StringMethods with a main method. what it does: 0. prompt user for a String - read String 1. prompt user for an int - read integer 2. if integer is 0 end program 3. if String is "0", end program 4. if integer is not between 1 and 10 go back to step 0 5. if integer is between 1 and 10 (inclusive) perform the operation and print the message that matches the examples below. Each number corresponds to a different operation. 6. repeat from step 0 

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' appears in second half enter a string (end with 0): abc enter an int (end with 0): 11 enter a string (end with 0): 0 % java StringMethods enter a string (end with 0): 1234z1234 enter an int (end with 0): 10 'z' appears in second half enter a string (end with 0): 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mysql Examples Explanations Explain Examples

Authors: Harry Baker ,Ray Yao

1st Edition

B0CQK9RN2J, 979-8872176237

More Books

Students also viewed these Databases questions

Question

How many three-digit numbers are divisible by 7?

Answered: 1 week ago

Question

What is Indian Polity and Governance ?

Answered: 1 week ago

Question

Describe your ideal working day.

Answered: 1 week ago