Difference between revisions of "Harder TreeMap Tutorial"

From Progzoo
Jump to: navigation, search
(Top ten countries.)
(Top ten countries.)
Line 108: Line 108:
 
   }
 
   }
 
   String x = byPop.lastKey();
 
   String x = byPop.lastKey();
   for (int i=0;i<10;i++){
+
   for (int i=0;i<10;i++)
 +
  {
 
     System.out.println(byPop.get(x).name);
 
     System.out.println(byPop.get(x).name);
 
     x = byPop.lowerKey(x);
 
     x = byPop.lowerKey(x);

Revision as of 20:42, 12 September 2012

These questions require you to create several structures.

Top ten countries.

Print the ten largest countries by population, in descending order.


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

Dominated Regions

A dominated region is one where a country has more than 50% of the region population. Print the name of the dominated region and the country which dominates it.

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

Colombia takes all.

Plucky Colombia takes over the whole of South America, transfer all resources to Colombia and remove every other country of South America.


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