Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class kobiety {
- static String pensje(String file) {
- String najmlodsza="";
- int por=999;
- try{
- RandomAccessFile raf = new RandomAccessFile(file, "rw");
- String line;
- while( (line=raf.readLine())!=null ){
- int wiek = Integer.parseInt(raf.readLine());
- long pos1 = raf.getFilePointer();
- double pensja = Double.parseDouble(raf.readLine());
- char plec = (raf.readLine()).charAt(0);
- long pos2 = raf.getFilePointer();
- if(plec=='K' && wiek>50) {
- raf.seek(pos1);
- raf.writeBytes(Double.toString(pensja*1.05));
- raf.seek(pos2);
- }
- if (wiek<por) najmlodsza = line;
- }
- }
- catch (IOException e) {System.out.println(e);}
- return najmlodsza;}
Add Comment
Please, Sign In to add comment