Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

THIS IS JAVA PROGRAMMING. You're required to write the following two overloaded methods: 1. public static int countLetters(String s) which count the number of English

THIS IS JAVA PROGRAMMING.

You're required to write the following two overloaded methods:

1. public static int countLetters(String s) which count the number of English letters in given String s.

2. public static int countLetters(String s, char c) which count the number of English letter c (not case sensitive) in given String s. If c is not an English letter, returns -1.

QUESTION: Write a test program with main function. When the program run, it shall run like: (The bold and italic ones are input)

Enter a string: hello 123$% world

Enter a char: 3

The result of calling function int countLetters(String s) is: 10

The result of calling function int countLetters(String s, char c) is: -1

Do your want to do another test? Y/N: y

Enter a string: %$#1234567 89 Hello hays

Enter a char: h

The result of calling function int countLetters(String s) is: 9

The result of calling function int countLetters(String s, char c) is: 2

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

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions

Question

What is the difference between s 2 X and s 2 Y ?

Answered: 1 week ago