Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

Java - ASCII Table


Prompt the user for an integer which will define the number of groups in your table. Produce an ASCII table from 0 to 127. Your table will be organized into groups of three little columns displaying the same value as a character, in hexadecimal and in decimal value. So each number in the table is displayed three times. Each of the groups of little columns will be 8 characters wide and neatly aligned (see sample output below). The alignment has to be neat for values less than 6. What is shown is just an example. Leave 4 blank spaces between groups. When you have printed the number of groups defined by the user input start a new line and continue. When you reach 127, stop printing regardless of which group you are in and print one extra newline character. Your solution must employ a loop that goes from 0 to 127. Within the loop there must be a second control structure to determine when to start a new line when you have enough groups printed. Include documentation readable by the javadoc utility suitable to a program of this size. Your documentation should include a general description of what this program does. Suggestions: Run your program from the command line in this exercise. It will give you a sharper output. The IDE provides you with an output console but it may not translate characters the same way the command box does. If you took your program to a Linux shell environment the output would most certainly look different. Consoles are like that. You will need to click Run - Clean and Build Main Project, to get the dist directory and the jar file produced. Clicking on the large green arrow in the IDE will not do it. The ASCII characters 7, 8, 9, 10 and 13 will probably cause trouble for you when you try to print them. They will mess up the alignment of your columns and drive you nuts. So instead of printing those characters just print a space. You still have to print the hex and decimal values. These characters are formatting controls like tab, carriage return and line feed. Reference: The ASCII table. I upload a picture who its suppose to look like Attachments Tags Clarifications


Java - Ascii Table - Solution


Attached is the solution to the Ascii table assignment including source and comments Attachments (1 K) Download Preview
c = (char)i; //check if character to convert to space if((i >= 7 && i <= 10) || i == 13){ c = ' '; } //get hex value String hex = Integer.toHexString(i); //get string with proper spacing String part =

Purchase Answer