Advertisement
Guest User

Untitled

a guest
May 25th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. import java.util.Random;
  2.  
  3. public class BrightnessSensor {
  4.  
  5. private int id;
  6. private float brightness;
  7. private double reliability;
  8.  
  9. public BrightnessSensor(int id) {
  10. this.id = id;
  11. this.brightness = getRandom();
  12. this.getReliability();
  13. }
  14.  
  15. public BrightnessSensor(BrightnessSensor other) {
  16.  
  17. }
  18.  
  19. public float getBrightness() {
  20. return brightness;
  21. }
  22.  
  23. public double getReliability() {
  24. return reliability;
  25. }
  26.  
  27. public float refresh(int t) {
  28. reliability = Math.pow(Math.E, -Math.pow(10, -3)*t);
  29. brightness = getRandom();
  30. return brightness;
  31. }
  32.  
  33. public String toString() {
  34. return ""+brightness;
  35. }
  36.  
  37. Random rand = new Random();
  38. private float getRandom() {
  39. return rand.nextFloat() * (200 - 0) + 0;
  40. }
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement