Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. public static void main(String[] args) throws FileNotFoundException {
  2.  
  3. int count = 400;
  4. int[] year = new int[count];
  5. int[] temperature = new int[count];
  6. int i = 0;
  7.  
  8. Scanner input = new Scanner(new File("data.txt"));
  9.  
  10. while(input.hasNextInt())
  11. {
  12. String line = input.nextLine();
  13. String[] items = line.split(" ");
  14. year[i] = Integer.valueOf(items[0]);
  15. temperature[i] = Integer.valueOf(items[1]);
  16. i++;
  17. }
  18.  
  19. for(i=0; i < year.length; i++){
  20. System.out.println("(" + year[i]+ ", " + temperature[i] + ")");
  21.  
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement