Copyright
© – Sudharsan Iyengar
CS – 234. Lab 7 Loops
Continued 3/6/25
Write a class – lab7methods
– that has the following methods.
a) A method that takes in a string and returns
the number of vowels in the string.
b) A method that takes in a number and returns
the number of digits in the number.
c) A method that takes in a string and returns a
number that is the sum of all the characters’ values (their ASCII equivalent) in
the string.
d) A method that takes a number and a character (letter)
and returns
a. A string that looks like a square drawn with
the letter (as shown below) if the number is even
If
the number is 4 and the letter is ‘a’ –
aaaa
a a
a a
aaaa
b. A string that looks like a triangle (as shown
below) if the number is odd
If
the number is 5 and the letter is P -
P
P P
PPPPP
Develop each of the
methods and test them by calling them in the driver class.