Can someone help me with these exercises? Exercise 1 Write a method (similar to
ID: 3552677 • Letter: C
Question
Can someone help me with these exercises?
Exercise 1
Write a method (similar to Xlength ()) that counts the number of times a particular character occurs in a string. The string and the particular character are both paramenters of the method.
For example
countChar ("XaaaYaaaZaaaYaaY", 'Y')
returns 3.
-------------------------------------------------------------------------------------------
Exercise 2
Write a method that creates a string that is similar to the arguement string but with all the vowels removed. Regard a, e, i, o, u (upper and lower case) as vowles.
For example
removeVowles ("counterrevolutionaries")
returns "cntrrvltnrs"
removeVowels ("AUDIOBOOK")
returns "DBK"
-----------------------------------------------------------------------------------------------
Exercise 3
A palindrome is a string that is the same when reserved. For example, "abba" is a palindrome. Here is a math-like definition.
palindrome ( "" ) = true
palindrome ( x ) = true
palindrome ( x + X + y ) = false, if x != y
= palindrome ( X ), if x == y
The symbol x stands for a single character, as does y. The symbol x stands for a string of characters. The symbol + stands for concatenation.
Implement palidrome () and a program that tests it.
Explanation / Answer
(( JAVA : Short & Simple Solutions with proper explanations ))
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.