Answered step by step
Verified Expert Solution
Question
1 Approved Answer
draw uml diagram of the code below public class Main { public static void main ( String [ ] args ) { BourseRateTracker rateTracker =
draw uml diagram of the code below
public class Main
public static void mainString args
BourseRateTracker rateTracker new BourseRateTracker;
CurrencyDisplay display new CurrencyDisplay;
CurrencyDisplay display new CurrencyDisplay;
rateTracker.registerObserverdisplay;
rateTracker.registerObserverdisplay;
rateTracker.setUsdTryRate;
import java.util.List;
import java.util.ArrayList;
public class BourseRateTracker implements CurrencyRateTracker
private List observers new ArrayList;
private double usdTryRate;
public void setUsdTryRatedouble rate
this.usdTryRate rate;
notifyObservers;
@Override
public void registerObserverObserver o
observers.addo;
@Override
public void removeObserverObserver o
observers.removeo;
@Override
public void notifyObservers
for Observer observer : observers
observer.updateusdTryRate;
public interface CurrencyRateTracker
void registerObserverObserver o;
void removeObserverObserver o;
void notifyObservers;
public class CurrencyDisplay implements Observer
@Override
public void updatedouble rate
System.out.printlnUpdated USDTRY Rate: rate;
public interface Observer
void updatedouble usdTryRate;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started