Question
Using Java language. Attach .java file and screenshot You've been hired by Braille Buddies to write a Java console application that prints the equivalent Braille
Using Java language. Attach .java file and screenshot
You've been hired by Braille Buddies to write a Java console application that prints the equivalent Braille of the text entered by the user. Braille is a special language used by the blind to read text. It uses a 3x2 grid of dots to represent different characters. Here are the grid definitions for Grade 1 Braille:
To specify an upper case letter, the "capital sign" grid defined above precedes a lower case letter. Use the following three-dimensional array declaration to represent the Braille grid definitions. The first dimension is the letter, the second dimension is the row, and the third dimension is the column of a spot in a grid. A one (1) indicates a big spot while a zero (0) indicates a small spot:
final int[ ] [ ] [ ] BRAILLE_GRIDS =
{
{{ 1, 0}, { 0, 0}, { 0, 0}}, // 'a' - 0
{{ 1, 0}, { 1, 0}, { 0, 0}}, // 'b' - 1
{{ 1, 1}, { 0, 0}, { 0, 0}}, // 'c' - 2
{{ 1, 1}, { 0, 1}, { 0, 0}}, // 'd' - 3
{{ 1, 0}, { 0, 1}, { 0, 0}}, // 'e' - 4
{{ 1, 1}, { 1, 0}, { 0, 0}}, // 'f' - 5
{{ 1, 1}, { 1, 1}, { 0, 0}}, // 'g' - 6
{{ 1, 0}, { 1, 1}, { 0, 0}}, // 'h' - 7
{{ 0, 1}, { 1, 0}, { 0, 0}}, // 'i' - 8
{{ 0, 1}, { 1, 1}, { 0, 0}}, // 'j' - 9
{{ 1, 0}, { 0, 0}, { 1, 0}}, // 'k' - 10
{{ 1, 0}, { 1, 0}, { 1, 0}}, // 'l' - 11
{{ 1, 1}, { 0, 0}, { 1, 0}}, // 'm' - 12
{{ 1, 1}, { 0, 1}, { 1, 0}}, // 'n' - 13
{{ 1, 0}, { 0, 1}, { 1, 0}}, // 'o' - 14
{{ 1, 1}, { 1, 0}, { 1, 0}}, // 'p' - 15
{{ 1, 1}, { 1, 1}, { 1, 0}}, // 'q' - 16
{{ 1, 0}, { 1, 1}, { 1, 0}}, // 'r' - 17
{{ 0, 1}, { 1, 0}, { 1, 0}}, // 's' - 18
{{ 0, 1}, { 1, 1}, { 1, 0}}, // 't' - 19
{{ 1, 0}, { 0, 0}, { 1, 1}}, // 'u' - 20
{{ 1, 0}, { 1, 0}, { 1, 1}}, // 'v' - 21
{{ 0, 1}, { 1, 1}, { 0, 1}}, // 'w' - 22
{{ 1, 1}, { 0, 0}, { 1, 1}}, // 'x' - 23
{{ 1, 1}, { 0, 1}, { 1, 1}}, // 'y' - 24
{{ 1, 0}, { 0, 1}, { 1, 1}}, // 'z' - 25
{{ 0, 0}, { 0, 0}, { 0, 1}} // upper case follows - 26
};
Use a validation loop to prompt for and get from the user a string that contains only upper and lower case letters and spaces. If an invalid string is entered, print an error message. If a valid string is entered, convert and display it in Braille. Print the following four lines for each string:
Line | Output |
Character | For an lower case letter, print the letter. For an upper case letter, print "UP" and the corresponding lower case letter. For the space character, print a space. |
Rows 1-3 | For lower case letters, print its grid. For upper case letters, prints two grids: the "capital sign" grid and the corresponding lower case letter grid. For the space character, print spaces. |
To access the correct grid in array BRAILLE_GRIDS, convert a lower case letter to value between 0 and 25 (the first dimension) using the fact that each character is assigned a unique integer. Here is a run with a sample string:
Enter a string (letters and spaces only) to convert to Braille (q to exit): Hello World
Character: UP h e l l o UP w o r l d
Row 1: 0 0 1 0 1 0 1 0 1 0 1 0 0 0 0 1 1 0 1 0 1 0 1 1
Row 2: 0 0 1 1 0 1 1 0 1 0 0 1 0 0 1 1 0 1 1 1 1 0 0 1
Row 3: 0 1 0 0 0 0 1 0 1 0 1 0 0 1 0 1 1 0 1 0 1 0 0 0
Enter a string (letters and spaces only) to convert to Braille (q to exit):
Continue to prompt the user for strings until they enter q. Use these strings for the last three inputs:
Run | Text |
1 | The quick Fox |
2 | Jumps over |
3 | the Lazy Dog |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started