Write a class ASCIICode that accepts any character from the keyboard then convert its decimal value into its corresponding ACSII Code. Print the character read and its ACSII code representation. Repeat the same procedure until you decide to stop.
Write a class ASCIICode that accepts any character from the keyboard then convert its decimal value into its corresponding ACSII Code.
Print the character read and its ACSII code representation.
Repeat the same procedure until you decide to stop.
(Hint1: use (int)(character) to get the decimal value of the character. [ int decimal = (int)(character); ]
Hint2: divide the decimal value by 2 until the quotion is less then 2. Each time you divide, add the remainder into a Queue.
Hint3: Reverse the values stored in the Queue using a Stack, then print the Stack (ASCII Code)]
Sample Output
Do you want to convert a character (Y/N)? y
Enter any character from the keyboard: A
The ASCII code for character A is 0100001
Do you want to convert another character (Y/N)? Y
Enter any character from the keyboard: 1
The ASCII code for character 1 is 00011000
Do you want to convert another character (Y/N)? N
Thank you for trying my code.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images