Difference between revisions of "Accumulators For Searching Tutorial"

From Progzoo
Jump to: navigation, search
(The biggest population)
(Which country has the biggest population?)
Line 67: Line 67:
 
import java.io.BufferedReader;
 
import java.io.BufferedReader;
 
import java.io.FileReader;
 
import java.io.FileReader;
public class Cia{
+
public class Cia
 +
{
 
   public static void main(String[] argv)
 
   public static void main(String[] argv)
                         throws Exception{
+
                         throws Exception
 +
{
 
     BufferedReader fh =
 
     BufferedReader fh =
 
     new BufferedReader(new FileReader("cia.txt"));
 
     new BufferedReader(new FileReader("cia.txt"));
 
     String line;
 
     String line;
     while ((line=fh.readLine())!=null){
+
     while ((line=fh.readLine())!=null)
 +
    {
 
       String [] wrds = line.split("\t");
 
       String [] wrds = line.split("\t");
 
       String  name  = wrds[0];
 
       String  name  = wrds[0];
Line 83: Line 86:
 
import java.io.BufferedReader;
 
import java.io.BufferedReader;
 
import java.io.FileReader;
 
import java.io.FileReader;
public class Cia{
+
public class Cia
 +
{
 
   public static void main(String[] argv)
 
   public static void main(String[] argv)
                         throws Exception{
+
                         throws Exception
 +
  {
 
     BufferedReader fh =
 
     BufferedReader fh =
 
       new BufferedReader(new FileReader("cia.txt"));
 
       new BufferedReader(new FileReader("cia.txt"));
Line 91: Line 96:
 
     int biggest = 0;
 
     int biggest = 0;
 
     String bigName = "unknown";
 
     String bigName = "unknown";
     while (null!=(line=fh.readLine())){
+
     while (null!=(line=fh.readLine()))
 +
    {
 
       String [] wrds = line.split("\t");
 
       String [] wrds = line.split("\t");
 
       String  name  = wrds[0];
 
       String  name  = wrds[0];
Line 113: Line 119:
 
</hint>
 
</hint>
 
</question>
 
</question>
 +
 
==Which middle eastern country has the smallest population?==
 
==Which middle eastern country has the smallest population?==
 
<question xmlns:htm="http://www.w3.org/1999/xhtml" lang="java" className="Cia" copyFile="cia.txt"><prog>
 
<question xmlns:htm="http://www.w3.org/1999/xhtml" lang="java" className="Cia" copyFile="cia.txt"><prog>

Revision as of 20:17, 12 September 2012

The biggest population

What is the population of the largest country (by population).

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

Which country has the biggest population?

What is the name of the largest country (by population).

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

Which middle eastern country has the smallest population?

What is the name of the country in region "Middle East" with the smallest population.

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