Java Reference
In-Depth Information
*4.9
(
Find the Unicode of a character
) Write a program that receives a character and
displays its Unicode. Here is a sample run:
Enter a character: E
The Unicode for the character E is 69
*4.10
(
Guess birthday
) Rewrite ListingĀ 4.3, GuessBirthday.java, to prompt the user to
enter the character
Y
for Yes and
N
for No rather than entering
1
for Yes and
0
forĀ No.
*4.11
(
Decimal to hex
) Write a program that prompts the user to enter an integer between
0
and
15
and displays its corresponding hex number. Here are some sample runs:
Enter a decimal value (0 to 15): 11
The hex value is B
Enter a decimal value (0 to 15): 5
The hex value is 5
Enter a decimal value (0 to 15): 31
31 is an invalid input
4.12
(
Hex to binary
) Write a program that prompts the user to enter a hex digit and
displays its corresponding binary number. Here is a sample run:
VideoNote
Convert hex to binary
Enter a hex digit: B
The binary value is 1011
Enter a hex digit: G
G is an invalid input
*4.13
(
Vowel or consonant?
) Write a program that prompts the user to enter a letter and
check whether the letter is a vowel or consonant. Here is a sample run:
Enter a letter: B
B is a consonant
Enter a letter grade: a
a is a vowel
Enter a letter grade: #
# is an invalid input
Search WWH ::
Custom Search