Formatting Numbers Tutorial

From Progzoo
Jump to: navigation, search

A floating point number includes a decimal point for example:

3.1
3.1415f

You might want to look at the following before tackling these questions:

Population in millions

For the countries of South America, show the name and the population in millions.

Example:

Argentina 39



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

Area

For the countries of South America show the name and the area in thousands of square kilometers to two decimal places.

Use 20 character spaces for the name and 10 for the area. Use commas for the area format.

Example:

Peru                  1,285.22



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

per Capita GDP

Show the name of the country and the per capita gdp for countries of Asia.

Use 20 character spaces for the name and 10 for the per capita GDP. Show the per capita GDP to two decimal places. The values are in US dollars, so include the $ sign right after the name.

Example:

China               $  1,290.00



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

Richer countries

The per capita GDP of the UK is a little less than $34,000

Show the name and per capita GDP of those countries with a per capita GDP of more than 29000

Use 25 character spaces for the name and 10 for the per capita GDP. Show the per capita GDP to two decimal places. The values are in US dollars, so include the $ sign right after the name.

Example:

United Kingdom          $ 29,483.08



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