I am using a web service to get currency rates for 4 different currencies. What I am doing so far is to get these rates and store then in a 4x4 matrix in a way that any value can be easily retrieved without having to use the web service everytime.
What I want to know is what is the best approach, using design patterns (and which one would be more appropriate) to set and get the values of this matrix. I am currently just using something like this:
public void setPoundToEuro(float value) {
currencyMatrix[0][1] = value;
}
public float getPoundToEuro() {
return currencyMatrix[0][1];
}
What I was hoping is to have something more abstract to whichever class needs to use this service and get these values. Something like another class calling a method just sending two Strings and the same method would return any currency rates, depending on the Strings received. In this case it would be "pound" and "euro".
I hope to have made myself clear, but if not, please let me know. I have not seen much questions like this here, so I hope this is not a problem, I am trying to discuss and find the best approach for my problem. I have already seen this design patterns for currency conversion? and it did help clarify somethings for me, but the situation is slightly different, so I thought it was reasonable to ask a new question.