// Path: DSRMI/src/main/java/dsrmi/data/Currency.java
// public class Currency implements java.io.Serializable {
//     private float crossOrder;
//     private float unit;
//     private String isim;
//     private String kod;
//     private String CurrencyName;
//     private String currencyCode;
//     private float forexBuying;
//     private float forexSelling;
//     private float banknoteBuying;
//     private float banknoteSelling;
// 
//     public float getCrossOrder() {
//         return crossOrder;
//     }
// 
//     public void setCrossOrder(float crossOrder) {
//         this.crossOrder = crossOrder;
//     }
// 
//     public float getUnit() {
//         return unit;
//     }
// 
//     public void setUnit(float unit) {
//         this.unit = unit;
//     }
// 
//     public String getIsim() {
//         return isim;
//     }
// 
//     public void setIsim(String isim) {
//         this.isim = isim;
//     }
// 
//     public String getKod() {
//         return kod;
//     }
// 
//     public void setKod(String kod) {
//         this.kod = kod;
//     }
// 
//     public String getCurrencyName() {
//         return CurrencyName;
//     }
// 
//     public void setCurrencyName(String currencyName) {
//         this.CurrencyName = currencyName;
//     }
// 
//     public String getCurrencyCode() {
//         return currencyCode;
//     }
// 
//     public void setCurrencyCode(String currencyCode) {
//         this.currencyCode = currencyCode;
//     }
// 
//     public float getForexBuying() {
//         return forexBuying;
//     }
// 
//     public void setForexBuying(float forexBuying) {
//         this.forexBuying = forexBuying;
//     }
// 
//     public float getForexSelling() {
//         return forexSelling;
//     }
// 
//     public void setForexSelling(float forexSelling) {
//         this.forexSelling = forexSelling;
//     }
// 
//     public float getBanknoteBuying() {
//         return banknoteBuying;
//     }
// 
//     public void setBanknoteBuying(float banknoteBuying) {
//         this.banknoteBuying = banknoteBuying;
//     }
// 
//     public float getBanknoteSelling() {
//         return banknoteSelling;
//     }
// 
//     public void setBanknoteSelling(float banknoteSelling) {
//         this.banknoteSelling = banknoteSelling;
//     }
// 
//     @Override
//     public String toString() {
//         return String.format("Currency{CurrencyName='%s', currencyCode='%s', forexBuying=%s, forexSelling=%s}", CurrencyName, currencyCode, forexBuying, forexSelling);
//     }
// }
// 
// Path: DSRMI/src/main/java/dsrmi/interfaces/InformationRetrieval.java
// public interface InformationRetrieval extends java.rmi.Remote {
// 
//     String[] getCurrencies() throws java.rmi.RemoteException;
// 
//     float convertCurrency(String kod1, String kod2, float amount)
//             throws java.rmi.RemoteException;
// }
// 
// Path: DSRMI/src/main/java/dsrmi/reader/TCMBReader.java
// public class TCMBReader {
// 
//     public static void main(String[] args) {
//         new TCMBReader().getCurrencies();
//     }
// 
//     public List<Currency> getCurrencies() {
//         System.out.println("Retrieving the currencies");
//         try {
//             XmlMapper mapper = XmlMapper.builder()
//                     .defaultUseWrapper(false)
//                     .enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES)
//                     .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
//                     .build();
// 
//             return mapper.readValue(new URL("https://www.tcmb.gov.tr/kurlar/today.xml"), new TypeReference<List<Currency>>() {
//                     })
//                     .stream()
//                     .filter(item -> item.getCurrencyCode() != null)
//                     .collect(Collectors.toList());
//         } catch (Exception e) {
//             e.printStackTrace();
//         }
//         return new ArrayList<>();
//     }
// }


import dsrmi.data.Currency;
import dsrmi.interfaces.InformationRetrieval;
import dsrmi.reader.TCMBReader;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;
import java.util.List;
            Registry registry = LocateRegistry.createRegistry(1099);
            registry.bind("InformationRetrieval", stub);
            System.out.println("Information retrieval is ready");
        } catch (Exception e) {
            System.err.println("Information retrieval exception: " + e);
            e.printStackTrace();
        }
    }

    public String[] getCurrencies() {
        System.out.printf("Sending %d currencies%n", currencies.size());
        return currencies.stream().map(Currency::getCurrencyCode).toArray(String[]::new);
    }

    public float convertCurrency(String kod1, String kod2, float amount) {
        Currency kod1Currency = getCurrency(kod1);
        Currency kod2Currency = getCurrency(kod2);
        if (kod1Currency != null && kod2Currency != null) {
            float result = (kod1Currency.getForexBuying() / kod1Currency.getUnit())
                    * amount / (kod2Currency.getForexSelling() / kod2Currency.getUnit());
            System.out.printf("%s %s is equal to %s %s%n", amount, kod1, result, kod2);
            return result;
        }
        return 0f;
    }

    private Currency getCurrency(String currencyCode) {
        for (Currency currency : currencies) {
            if (currency.getCurrencyCode().equals(currencyCode)) {
                System.out.printf("Sending currency%s%n", currency);
// Path: DSRMI/src/main/java/dsrmi/data/Currency.java
// public class Currency implements java.io.Serializable {
//     private float crossOrder;
//     private float unit;
//     private String isim;
//     private String kod;
//     private String CurrencyName;
//     private String currencyCode;
//     private float forexBuying;
//     private float forexSelling;
//     private float banknoteBuying;
//     private float banknoteSelling;
// 
//     public float getCrossOrder() {
//         return crossOrder;
//     }
// 
//     public void setCrossOrder(float crossOrder) {
//         this.crossOrder = crossOrder;
//     }
// 
//     public float getUnit() {
//         return unit;
//     }
// 
//     public void setUnit(float unit) {
//         this.unit = unit;
//     }
// 
//     public String getIsim() {
//         return isim;
//     }
// 
//     public void setIsim(String isim) {
//         this.isim = isim;
//     }
// 
//     public String getKod() {
//         return kod;
//     }
// 
//     public void setKod(String kod) {
//         this.kod = kod;
//     }
// 
//     public String getCurrencyName() {
//         return CurrencyName;
//     }
// 
//     public void setCurrencyName(String currencyName) {
//         this.CurrencyName = currencyName;
//     }
// 
//     public String getCurrencyCode() {
//         return currencyCode;
//     }
// 
//     public void setCurrencyCode(String currencyCode) {
//         this.currencyCode = currencyCode;
//     }
// 
//     public float getForexBuying() {
//         return forexBuying;
//     }
// 
//     public void setForexBuying(float forexBuying) {
//         this.forexBuying = forexBuying;
//     }
// 
//     public float getForexSelling() {
//         return forexSelling;
//     }
// 
//     public void setForexSelling(float forexSelling) {
//         this.forexSelling = forexSelling;
//     }
// 
//     public float getBanknoteBuying() {
//         return banknoteBuying;
//     }
// 
//     public void setBanknoteBuying(float banknoteBuying) {
//         this.banknoteBuying = banknoteBuying;
//     }
// 
//     public float getBanknoteSelling() {
//         return banknoteSelling;
//     }
// 
//     public void setBanknoteSelling(float banknoteSelling) {
//         this.banknoteSelling = banknoteSelling;
//     }
// 
//     @Override
//     public String toString() {
//         return String.format("Currency{CurrencyName='%s', currencyCode='%s', forexBuying=%s, forexSelling=%s}", CurrencyName, currencyCode, forexBuying, forexSelling);
//     }
// }
// 
// Path: DSRMI/src/main/java/dsrmi/interfaces/InformationRetrieval.java
// public interface InformationRetrieval extends java.rmi.Remote {
// 
//     String[] getCurrencies() throws java.rmi.RemoteException;
// 
//     float convertCurrency(String kod1, String kod2, float amount)
//             throws java.rmi.RemoteException;
// }
// 
// Path: DSRMI/src/main/java/dsrmi/reader/TCMBReader.java
// public class TCMBReader {
// 
//     public static void main(String[] args) {
//         new TCMBReader().getCurrencies();
//     }
// 
//     public List<Currency> getCurrencies() {
//         System.out.println("Retrieving the currencies");
//         try {
//             XmlMapper mapper = XmlMapper.builder()
//                     .defaultUseWrapper(false)
//                     .enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES)
//                     .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
//                     .build();
// 
//             return mapper.readValue(new URL("https://www.tcmb.gov.tr/kurlar/today.xml"), new TypeReference<List<Currency>>() {
//                     })
//                     .stream()
//                     .filter(item -> item.getCurrencyCode() != null)
//                     .collect(Collectors.toList());
//         } catch (Exception e) {
//             e.printStackTrace();
//         }
//         return new ArrayList<>();
//     }
// }


// Path: DSRMI/src/main/java/dsrmi/server/InformationRetrievalImpl.java
import dsrmi.data.Currency;
import dsrmi.interfaces.InformationRetrieval;
import dsrmi.reader.TCMBReader;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;
import java.util.List;

            Registry registry = LocateRegistry.createRegistry(1099);
            registry.bind("InformationRetrieval", stub);
            System.out.println("Information retrieval is ready");
        } catch (Exception e) {
            System.err.println("Information retrieval exception: " + e);
            e.printStackTrace();
        }
    }

    public String[] getCurrencies() {
        System.out.printf("Sending %d currencies%n", currencies.size());
        return currencies.stream().map(Currency::getCurrencyCode).toArray(String[]::new);
    }

    public float convertCurrency(String kod1, String kod2, float amount) {
        Currency kod1Currency = getCurrency(kod1);
        Currency kod2Currency = getCurrency(kod2);
        if (kod1Currency != null && kod2Currency != null) {
            float result = (kod1Currency.getForexBuying() / kod1Currency.getUnit())
                    * amount / (kod2Currency.getForexSelling() / kod2Currency.getUnit());
            System.out.printf("%s %s is equal to %s %s%n", amount, kod1, result, kod2);
            return result;
        }
        return 0f;
    }

    private Currency getCurrency(String currencyCode) {
        for (Currency currency : currencies) {
            if (currency.getCurrencyCode().equals(currencyCode)) {
                System.out.printf("Sending currency%s%n", currency);
                return currency;