Question: Question: View: a class with one field private List models and 3 methods: public void Attach ( Model m ) public void Detach ( Model
Question:
View: a class with one field private List models
and methods:
public void AttachModel m
public void DetachModel m
public void Notifyint s
ConcreteView: a class inheritents from View,
one field
private int state ;
and two methods:
public int GetState
public void SetStateint s
Model: an abstract class with one abstract method:
public abstract void Updateint s;
ConcreteModel: a class inheritents from Model.
two fields
private int state;
private ConcreteView view;
one method
public void Updateint s
Task: finish implementing the code and run the main method below.
public static void mainString args
TODO Autogenerated method stub
Random r new Random;
int max ;
int min ;
View v new ConcreteView;
Model m new ConcreteModel v;
vAttachm;
forint i ; i ; i
int temp rnextIntmaxminmin;
Model m new ConcreteModeltemp v;
vAttachm;
List models vgetModels;
System.out.printlnSize of models models.size;
vDetach m;
System.out.printlnSize of models after delection models.size;
vNotifymax;
ConcreteView vConcreteView v;
System.out.printlnCurrent State is vGetState;
Sample Output:
Size of models
Size of models after delection
Current State is
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
