Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class domki {
- static String zmniejsz(String plik){
- String nazwDom="";
- int max = 0;
- try{
- RandomAccessFile raf = new RandomAccessFile(plik, "rw");
- String line;
- while( (line=raf.readLine())!=null ){
- String nazwa = line;
- int IKondygn = Integer.parseInt(raf.readLine());
- long pos1 = raf.getFilePointer();
- double cena = Double.parseDouble(raf.readLine());
- long pos2 = raf.getFilePointer();
- if(IKondygn==1) {
- cena*=0.9;
- raf.seek(pos1);
- raf.writeBytes(Double.toString(cena));
- raf.seek(pos2);
- }
- if (IKondygn>max) {max=IKondygn; nazwDom = nazwa;}
- }
- raf.close();
- }
- catch(IOException e) {System.out.println(e);};
- return nazwDom;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement