Advertisement
polpoteu

JAVA Egz Pesel

Mar 5th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. //
  2. // GRUPA D ZADANIE 1 PESEL
  3. //
  4.  
  5. public class App {
  6.  
  7. public static int[] Pesel(String tab[][]) {
  8. int [] odp = new int[tab.length];
  9.  
  10. int wartosc=0;
  11. int pes = 0;
  12.  
  13.  
  14. for(int i=0;i<tab.length;i++) {
  15. for(int j =0; j<tab[i].length;j++) {
  16.  
  17. wartosc = Integer.parseInt(String.valueOf(tab[i][0].charAt(j)));
  18.  
  19. if(j == 1 || j ==5 || j==10) {
  20. wartosc = wartosc * 3;
  21. }
  22. else if(j==2 || j==6) {
  23. wartosc = wartosc * 7;
  24.  
  25. }
  26. else if(j==3 || j==7) {
  27. wartosc = wartosc * 9;
  28. }
  29.  
  30. pes =+ wartosc;
  31.  
  32. }if(pes % 10 ==0) {
  33.  
  34. tab[i][1] ="POPRAWNY";
  35.  
  36. }else tab[i][1] = "BLEDNY";
  37.  
  38. }
  39.  
  40.  
  41. return odp;
  42. }
  43.  
  44.  
  45. public static void main(String[] args) {
  46.  
  47. }
  48.  
  49.  
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement