@Override
    public double calculateMonthlyPayment(double loanAmount, double numberOfYears, 
    double annualInterestRate, String currency) throws RemoteException {
        exchangeRate = FindExchangeRateXML.FindExchangeRatesXML(currency);
        loanAmount = loanAmount*exchangeRate;
        rate = annualInterestRate/1200;
        monthlyPmt = (loanAmount*(rate + rate/(Math.pow(1+rate, numberOfYears*12)-1)));
        String result = String.format("Annual Interest Rate: %.2f, Number of years:%.2f, Loan Amount: %.2f %s, monthly payment in BGN: %.2f\n", annualInterestRate, numberOfYears, loanAmount, currency, monthlyPmt);
        System.out.println(result);
        try {
            saveInFile(result);
        } catch (IOException ex) {
            Logger.getLogger(LoanServerInterfaceImpl.class.getName()).log(Level.SEVERE, null, ex);
        }
        return monthlyPmt;
    }