observer/1 to 1 relationship
Hi, I have a Bank class that has a 1 to 1 relationship with an InterestRate class and I have another class which should be observing any change to the interest rate.
My trouble is that I dont know how to just create one instance of the InterestRate class and be able to set the interest rate to a different value.
I would really appreciate any help.
Thanks
I have created a new InterestRate object in Bank to link the two classes and initalise the interest rate, but I get an error:
Bank.java:210: setInterestRate(double) in InterestRate cannot be applied
to (InterestRate)
theInterestRate.setInterestRate(anIntRate);
^
theInterestRate being the initial setup in Bank to access methods inside the InterestRate class.
does anyone know where I'm going wrong?