pborawski

metoda

Oct 12th, 2012
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. /*
  2. * To change this template, choose Tools | Templates
  3. * and open the template in the editor.
  4. */
  5. package metrozsko;
  6.  
  7. import java.util.*;
  8. import java.text.*;
  9.  
  10. public class MetRozSko {
  11.  
  12.  
  13. public int ilePtk;
  14. public int temperatura[];
  15. public int sciany[];
  16. Punkt[] p;
  17.  
  18. public void wczytajPunkty() {
  19. System.out.println("Ile puntkow chcemy wczytac?");
  20. Scanner s = new Scanner(System.in);
  21. ilePtk = s.nextInt();
  22. Punkt temp[] = new Punkt[ilePtk];
  23. int x, y;
  24. for(int i = 0; i < ilePtk; i++) {
  25. temp[i] = new Punkt(0, 0);
  26. System.out.println("Wpisz ptk nr " + (i+1));
  27. System.out.println("Wpisz zmienna x");
  28. temp[i].x = s.nextInt();
  29. System.out.println("Wpisz zmienna y");
  30. temp[i].y = s.nextInt();
  31. }
  32. p = temp;
  33. }
  34. private void wczytajTemp() {
  35. int temp[] = new int[ilePtk];
  36. for(int i = 0; i < ilePtk; i++) {
  37. System.out.println("Temperatura pomiedzy ptk " + (i+1) + " a ptk " + (i+2));
  38. Scanner s = new Scanner(System.in);
  39. temperatura[i] = s.nextInt();
  40. }
  41. temperatura = temp;
  42. }
  43. public void wczytajDane() {
  44. wczytajPunkty();
  45. wczytajTemp();
  46. obliczDlugosci();
  47. }
  48. public void obliczDlugosci() {
  49. for(int i = 0; i < ilePtk; i++)
  50. sciany[i] = p[i+1].x - p[i].x;
  51. }
  52. public void szukajNajdluzszej() {
  53.  
  54. }
  55. public static void main(String[] args) {
  56. int tablica[][] = new int[][] { {1,1,1,1,1},{1,1,1,1,1},{1,1,1,1,1},{1,1,1,1,1},{1,1,1,1,1} };
  57. MetRozSko m = new MetRozSko();
  58. m.wczytajDane();
  59. }
  60.  
  61. }
Advertisement
Add Comment
Please, Sign In to add comment