Difference between revisions of "Simple Printing Tutorial"

From Progzoo
Jump to: navigation, search
Line 1: Line 1:
<shell import='shells.xml#raster'/>
 
<diarem/>
 
 
 
{{World Factbook Tutorial}}
 
{{World Factbook Tutorial}}
 
<shell lang="java" className="Cia" import="shells_bbc.xml#fun" lang='java'/>
 
<shell lang="java" className="Cia" import="shells_bbc.xml#fun" lang='java'/>

Revision as of 09:56, 13 September 2012

What is the name?

The method oneLine will get called over 200 times. Each time the five parameters

 name region area pop gdp
will have different values.

The example program lists the region for each country.

Change the program so that it prints the name instead.


[Font] [Default] [Show] [Resize] [History] [Profile]

Show the name and the population

This program prints the name and the area for each country. Notice that the +" "+ puts a space between the two variables.

Change the program so that it prints the name followed by the population instead of the area.



[Font] [Default] [Show] [Resize] [History] [Profile]

Show the population in millions

Show the name and the population in millions.

Afghanistan has population 26 million
Albania has population 3 million
Algeria has population 32 million
Andorra has population 0 million
Angola has population 14 million
...
 


[Font] [Default] [Show] [Resize] [History] [Profile]