Advertisement
Kslash22

Interval

Jun 24th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.67 KB | None | 0 0
  1. package data;
  2.  
  3. public class Interval {
  4.    
  5.     private float inf; //estremo inferiore
  6.     private float sup; //estremo superiore
  7.    
  8.     Interval(float inf, float sup) {
  9.  
  10.         this.inf = inf;
  11.         this.sup = sup;
  12.    
  13.     }
  14.    
  15.     void setInf(float inf) {
  16.  
  17.         this.inf= inf;
  18.    
  19.     }
  20.    
  21.     void setSup(float sup) {
  22.  
  23.         this.sup=sup;
  24.        
  25.     }
  26.    
  27.     float getInf() {
  28.  
  29.         return inf;
  30.    
  31.     }
  32.    
  33.     float getSup() {
  34.  
  35.         return sup;
  36.    
  37.     }
  38.    
  39.     boolean checkValueInclusion(float value) {
  40.        
  41.         if(value>=this.inf & value<=this.sup) {
  42.             return true;
  43.         }
  44.         else {
  45.             return false;
  46.         }
  47.    
  48.     }
  49.    
  50.     public String toString() {
  51.    
  52.         String x = this.getInf() + " " + this.getSup();
  53.         return x;
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement