import java.util.Scanner;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.NoSuchElementException;
import java.util.InputMismatchException;

public class PopDen01{
    public static void main(String[] args){
        String filename = "countryData.txt";
        File fileObj = new File( filename );
        Scanner fileScanner = null;
        try{
            // Try to open data file
            fileScanner = new Scanner(fileObj);
        }catch(FileNotFoundException e){
            System.err.println("Sorry, unable to open '" + filename + "':" + e.getMessage());
            System.exit(1);
        }

        try{
            // Ignore first line
            String header = fileScanner.nextLine();
            // System.err.println("DEBUGGING: header: '" + header + "'");

            // For each subsequent line
            while( fileScanner.hasNext() ){
                // Read in county name, population and area
                String countryId = fileScanner.next();
                int population = fileScanner.nextInt();
                double area = fileScanner.nextDouble();

                // Display population density (population / area), rounded to 1 decimal place
                double populationDensity = population / area;
                System.out.println(countryId + "\t" + Math.round(populationDensity * 10.0) / 10.0);
            }
        }catch(InputMismatchException e){
            System.err.println("Sorry, unable to parse the type '" + filename + "':" + e.getMessage());
        }catch(NoSuchElementException e){
            System.err.println("Sorry, unable to parse '" + filename + "':" + e.getMessage());
        }
        fileScanner.close();
    }
}