Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

q1-q5 q4: Write a public static method named q4 that takes a String as a parameter and returns * an int. The return value is

q1-q5 image text in transcribed
image text in transcribed
q4: Write a public static method named q4 that takes a String as a parameter and returns * an int. The return value is the total number of times "1" and "p" appear in the input * String *Hint: If the second argument of the replace method is th matching characters will be * removed (Replaced with nothing) * See (https://docs.oracle.com/Java se/8/docs/api/java/lang/String .html#method. summary) for a * complete list of methods contained in the String class. You may call any of these methods * in your method kak * q5: Write a public static method named q5 that takes a String as a parameter and returns a *String. The returned String is based on the input String as follows: *If the input String has no characters, return "empty" If the input String has less than 3 characters, return "short * If the input String has 3 or more characters but less than 8, return "medium" If the input String has greater than or equal to 8 characters, return "long" If the input String contains any instances of the letterq', return "found q" regardless * of the length of the input

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

Logics For Databases And Information Systems

Authors: Jan Chomicki ,Gunter Saake

1st Edition

1461375827, 978-1461375821

More Books

Students also viewed these Databases questions