leniuch

kobiety++

Feb 25th, 2020
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.72 KB | None | 0 0
  1. public class kobiety {
  2.  
  3.    
  4.    static String pensje(String file) {
  5.    String najmlodsza="";
  6.    int por=999;
  7.    
  8.    try{
  9.    RandomAccessFile raf = new RandomAccessFile(file, "rw");
  10.    String line;
  11.    while( (line=raf.readLine())!=null ){
  12.    int wiek = Integer.parseInt(raf.readLine());
  13.    long pos1 = raf.getFilePointer();
  14.    double pensja = Double.parseDouble(raf.readLine());
  15.    char plec = (raf.readLine()).charAt(0);
  16.    long pos2 = raf.getFilePointer();
  17.    if(plec=='K' && wiek>50) {
  18.    raf.seek(pos1);
  19.    raf.writeBytes(Double.toString(pensja*1.05));
  20.    raf.seek(pos2);
  21.    }
  22.    if (wiek<por) najmlodsza = line;
  23.    }
  24.    }
  25.    catch (IOException e) {System.out.println(e);}
  26.    
  27.    
  28.    return najmlodsza;}
Add Comment
Please, Sign In to add comment