Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Do correctly in java 1)Java Program to Count The Product of Numbers in a String We need to find the product of the numbers present

Do correctly in java

1)Java Program to Count The Product of Numbers in a String

We need to find the product of the numbers present in the string. We can have alphabets as well as some digits so we need to find the product of the digits.

Input:- 4PREP2INSTAA6HFRE7

Output:- 336

2)

Write a program to reverse the given string word by word Note: Use the concept of loops

Sample Input: Hi Good Evening

Sample Output: iH dooG gninevE

3)

Write a Java method to check whether a string is a valid password.

Password rules:

The password should not contain any space.

Password should contain at least one digit(0-9).

Password length should be between 8 to 15 characters.

Password should contain at least one lowercase letter(a-z).

Password should contain at least one uppercase letter(A-Z).

Password should contain at least one special character specified ( #, %, &, $).

Sample Input: Alpha#3579

Sample Output: Valid

4)

Write a program to remove leading and trailing spaces from a string in Java

Approach 1:

To remove leading and trailing spaces in Java, use the trim() method. This method returns a copy of this string with leading and trailing white space removed, or this string if it has no leading or trailing white space.

Approach 2:

Remove the spaces without using the trim()

Sample Input: " Hi good evening "

Sample Output: "Hi good evening"

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

Database And Expert Systems Applications 24th International Conference Dexa 2013 Prague Czech Republic August 2013 Proceedings Part 2 Lncs 8056

Authors: Hendrik Decker ,Lenka Lhotska ,Sebastian Link ,Josef Basl ,A Min Tjoa

2013th Edition

3642401724, 978-3642401725

More Books

Students also viewed these Databases questions

Question

Describe the secant function.

Answered: 1 week ago

Question

How and when will I measure my success? Questions

Answered: 1 week ago

Question

3. What are the current trends in computer hardware platforms?

Answered: 1 week ago