Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.

1. ## Unsure how to answer a question

Hi,

In a book I've been reading, there's a section containing questions regarding the chapter. I'm fine with pretty much every single exercise par one, which involves thorough reading of the previous chapter - I've read through the chapter many times, but I've yet to find the answer. Here's the question:

1. Write a program that will print your initials to standard output in letters that are nine
lines tall. Each big letter should be made up of a bunch of *’s. For example, if your initials
were “DJE”, then the output would look something like:

(Nine line tall letter using asterixes)

It would be great if you could help.

Thanks,

James

• Print your initials, or print any initials provided?

• Originally Posted by Fou-Lu
Print your initials, or print any initials provided?
Initials provided (you have to actually input your initials)

• This will be a tremendous task to do. Although it may be possible to make use of the GlyphVector class in some way, I haven't a clue of how it would be done. Unfortunately, graphics are far from my specialty. May even be able to make use of just the Graphics2D class to help on that too. Effectively, you'd map a pixel by pixel check of a Character and compare it to a matrix or array to fill it.

Barring that, since I haven't a clue if that's even doable, its manual. You start with:
• Using a spreadsheet, block a 9x9 cell grid
• Draw your representation of a character
• Use the data there to populate a multidimensional array

I'd actually make a Matrix for it. Then it becomes quite easy since you can create a `Vector<Matrix<Character>>` as your datatype to collect the initials in, then use standard iteration to display it. Populate the Matrix with the location of the stars, then use the map to look up the inserted letter and add it to the vector. Iterating becomes easy since you can make use of % to determine which character you are evaluating.

I can't think of an easier solution. This is a heck of a task to map 9x9 to 26 characters.

• Originally Posted by Fou-Lu
This will be a tremendous task to do. Although it may be possible to make use of the GlyphVector class in some way, I haven't a clue of how it would be done. Unfortunately, graphics are far from my specialty. May even be able to make use of just the Graphics2D class to help on that too. Effectively, you'd map a pixel by pixel check of a Character and compare it to a matrix or array to fill it.

Barring that, since I haven't a clue if that's even doable, its manual. You start with:
• Using a spreadsheet, block a 9x9 cell grid
• Draw your representation of a character
• Use the data there to populate a multidimensional array

I'd actually make a Matrix for it. Then it becomes quite easy since you can create a `Vector<Matrix<Character>>` as your datatype to collect the initials in, then use standard iteration to display it. Populate the Matrix with the location of the stars, then use the map to look up the inserted letter and add it to the vector. Iterating becomes easy since you can make use of % to determine which character you are evaluating.

I can't think of an easier solution. This is a heck of a task to map 9x9 to 26 characters.
Thanks for the reply, but judging by the fact that this is only chapter 2 of a complete beginner's book, I'm presuming you'd make it via the use of a foreign subroutine, which is provided in the book (math.hws.edu/javanotes/source/TextIO.java).

Thanks for helping, if you could possibly skim through that it would be great.

• Solved, thanks for helping, but it was actually an unbelievable fix and I'd actually happened to misinterpret the question (it pretty much involved lines of System.out.prints)

• That's great; I didn't have a chance to follow that link as I was out all evening yesterday.
If I were doing this and had extra time, I'd still do one for each character. If its entry level course, the ONLY way to approach that would be to use an char[][] assuming that datastructures haven't been covered (ie: you'd make a matrix otherwise). So manual c[5][8] = '*'; placement lol.
But it would sure look cool to take any initials and have it spit out.

•

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•