Question: how can i make this class generateAvg return 0 before getting the average using observable? make it initially have no average 3+ import java.util.Observable;. 6

how can i make this class generateAvg return 0 before getting the average using observable?

make it initially have no average

how can i make this class generateAvg return 0 before getting the

3+ import java.util.Observable;. 6 public class generateAvg extends Observable { private int seed; double average = 0; private Random r = new Random(); 10 126 13 14 15 public generateAvg(int seed) { this. seed = seed; r.setSeed(this.seed); } 16 176 18 public double getAvg() { average = r.nextDouble()*10.0; return average; } 19 20 /** * Updates radiation, changes the state to true, and notifies all observers of * the change. 25 266 27 public void readRadiation() { setChanged(); notifyObservers(getAvg()); } 28 29 30 } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!