Java Exercises
Java Exercises
METHOD SIGNATURE
pig igpay
computer omputercay
chair airchay
apple appleay
0 1
110 3
3210 4
RULES
Arrays and Strings are not allowed. 2. Write a method that will sort a non-negative integer.
METHOD SIGNATURE
pig, gip
true
banana, potato
false
0 0
110 11
321 123
INPUT OUTPUT
RULES
Arrays and Strings are not allowed. 3. Write a method that reverses a string.
METHOD SIGNATURE
7. Given an integer between 0 and 999,999, return an English phrase that describes the integer.
METHOD SIGNATURE
EXAMPLES INPUT
100
"One Hundred"
1,234
"One Thousand, Two Hundred and Thirty Four"
a a
abc
cba
abc123 321cba
OUTPUT
Built-in method reverse() is forbidden to use. 4. Write a method that will convert a word to piglatin. A piglatin is formed by moving the first group of consonant to the end of a word and appeding ay.
METHOD SIGNATURE