A Letter to Yourself
source link: http://programmingbydoing.com/a/letter-to-yourself.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
- Author: Graham Mitchell
- Filename: LetterToYourself.java
A Letter to Yourself
Write a program that displays your name and address on the screen as if it were a letter. Your output should look something like that below.
U:\>java LetterToYourself +---------------------------------------------------------+ | #### | | #### | | #### | | | | | | Bill Gates | | 1 Microsoft Way | | Redmond, WA 98104 | | | +---------------------------------------------------------+
Frequently-Asked Questions
Does my letter have to look exactly like yours? No, but it does have to look roughly like a letter, including the box around the outside and the stamp.
Do I have to use my real address? Of course not. But make sure your fake address takes up three lines.
How to I get a |
to show up on the screen?
The |
character is called a "pipe". Assuming you are using
a normal US keyboard, it is Shift + backslash (\
). The backslash
key is usually located between the Backspace and Enter keys.
Why doesn't my letter line up when I run the program?!? Everything looks perfect in the code!
You probably used a mixture of tabs and spaces between the
quotes in your println()
statements. Many text editors / IDEs
will only move the cursor 4 spaces when you press TAB. But when your
program runs, any tabs embedded inside the quotes will take up 8 spaces, not 4.
If you delete ALL the tabs between the quotes and replace them with spaces, things
should look the same in your code and when you run the program.
(Most good text editors have an option to show visible whitespace,
which can make it easier to fix this. For example, JCreator has a
"Show Whitespace" option in the "View" menu, which will display
spaces in your code with a small dot like ⋅
and will display tabs with a little double bracket like
»
.)
©2013 Graham Mitchell
This assignment is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
Recommend
-
103
README.md Dear GitHub, Before 2007, the way to participate in Open Source was fragmented. Each project had its own workflow, patches circulated in emails, issues were reported i...
-
39
letter to santa {turnoff.us} RSS.sign() | fac...
-
81
A Love Letter to Plain TextI have used Hugo, the blog engine this blog runs on top of, more and more lately for less and less typical use cases. Hopefully this post will inspire others in similar ways.
-
134
AMP Letter Signing the letter as an individual The letter uses Jekyll to combine and sort signatures. Please create a file
-
88
Vim-Flattery Flattery will lead you everywhere. Flattery provides targets for f/t searches, either as a conveniency [eg. fb searching for ), as...
-
52
In the frustratingly fast-paced, ever-shifty and profoundly fashion-driven JavaScript web development ecosystem, it’s not easy to find something that one can even stand to use, to say nothing of love. And if yo...
-
34
-
36
A bigram is a pair of letters. For various reasons—word games, cryptography, user interface development, etc.—people are interested in knowing which bigrams...
-
24
-
6
How to write a letter of recommendation—for yourself...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK