Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.BufferedReader;
- import java.io.FileReader;
- import java.io.IOException;
- public class Poliklinika {
- private Lekar[] lekari;
- public Poliklinika(String fajl1, String fajl2) throws IOException {
- BufferedReader br = new BufferedReader(new FileReader(fajl1));
- int brLekara = Integer.parseInt(br.readLine());
- lekari = new Lekar[brLekara];
- for(int i = 0; i < brLekara; i++) {
- String ime = br.readLine();
- String prezime = br.readLine();
- String zanimanje = br.readLine();
- if(zanimanje.equals("pedijatar")) {
- lekari[i] = new Pedijatar(ime, prezime);
- }
- else {
- lekari[i] = new Pulmolog(ime, prezime);
- }
- }
- br = new BufferedReader(new FileReader(fajl2));
- int brPacijenata = Integer.parseInt(br.readLine());
- for(int i = 0; i < brPacijenata; i++) {
- String ime = br.readLine();
- String prezime = br.readLine();
- int brGodina = Integer.parseInt(br.readLine());
- int randomBr = (int)(Math.random() * brLekara);
- Pacijent p = new Pacijent(ime, prezime, brGodina);
- lekari[randomBr].prihvati(p);
- }
- br.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement