Graduation Sentence with Variables

Write a program that stores your name and year of graduation into variables, and displays their values on the screen.

Make sure that you use two variables, and that the variable that holds your name is the best type for such a variable, and that the variable that holds the year is the best type for that variable.

Also make sure that your variable names are good: the name of a variable should always relate to its contents.

My name is Juan Valdez and I'll graduate in 2010.

Notice that in the example above, the values "Juan Valdez" and 2010 have been stored in variables before printing.

You're doing it wrong if your program looks like this:

	System.out.println( "My name is Juan Valdez and I'll graduate in 2010." );

It is wrong because it does not use any variables. You will still have you use println, of course, but your statement will have two variables in it along with words in quotes.




©2014 Graham Mitchell

This assignment is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
Creative Commons License