Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. package zad2;
  2. import java.io.*;
  3.  
  4. public class Tacke {
  5.  
  6. public static void main(String[] args) throws Exception
  7. {
  8. double array[][]=new double[2][2];
  9. FileReader fr = new FileReader("tacke.txt");
  10. BufferedReader br = new BufferedReader(fr);
  11. int i=0;
  12. try
  13. {
  14. String s = "";
  15. while ((s = br.readLine()) != null)
  16. {
  17. array[0][i]=Double.parseDouble(s.substring(1,s.indexOf(',')));
  18. array[1][i++]=Double.parseDouble(s.substring(s.indexOf(',')+1,s.indexOf(')')));
  19. }
  20. }
  21. finally
  22. {
  23. br.close();
  24. }
  25. for(int j=0;j<i;j++)
  26. {
  27. System.out.println(j+1+". tacka:" );
  28. System.out.println("x="+array[0][j]+" y="+array[1][j]);
  29. }
  30. }
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement