Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class main
- {
- double funkcja(String nazwa, String szukaneNazwisko)
- {
- String nowaNazwa;
- String nowaNazwa1;
- nowaNazwa=nazwa+".TXT";
- nowaNazwa1=nazwa+".WYN";
- String nazwisko;
- int rokStudiow, rokLiczba;
- double sredniaOcen;
- double sredniaOcenDoZw;
- char plec;
- try(BufferedReader nowy = new BufferedReader(new FileReader(nowaNazwa)))
- {
- try(BufferedWriter nowy1 = new BufferedWriter( new FileWriter(nowaNazwa1)))
- {
- String linie;
- String abc;
- String lance="";
- while((linie=nowy.readLine())!=null)
- {
- nazwisko=linie;
- sredniaOcen= Integer.parseInt(nowy.readLine());
- rokStudiow=Integer.parseInt(nowy.readLine());
- if(nazwisko==szukaneNazwisko)
- {
- return sredniaOcen;
- }
- abc=nowy.readLine();
- plec=abc.charAt(0);
- if(rokStudiow<=2 && plec=='K')
- {
- lance=nazwisko+String.valueOf(sredniaOcen)+"."+String.valueOf(rokStudiow)+"."+plec;
- nowy1.write(lance);
- }
- }
- }
- catch(IOException e){ e.getMessage();}
- }
- catch(IOException e){ e.getMessage();}
- return 0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement