Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- public class BrightnessSensor {
- private int id;
- private float brightness;
- private double reliability;
- public BrightnessSensor(int id) {
- this.id = id;
- this.brightness = getRandom();
- this.getReliability();
- }
- public BrightnessSensor(BrightnessSensor other) {
- }
- public float getBrightness() {
- return brightness;
- }
- public double getReliability() {
- return reliability;
- }
- public float refresh(int t) {
- reliability = Math.pow(Math.E, -Math.pow(10, -3)*t);
- brightness = getRandom();
- return brightness;
- }
- public String toString() {
- return ""+brightness;
- }
- Random rand = new Random();
- private float getRandom() {
- return rand.nextFloat() * (200 - 0) + 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement