Advertisement
Guest User

Untitled

a guest
Oct 29th, 2013
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1. class ComplexNumber <T extends Number,U extends Number> implements Comparable<ComplexNumber> {
  2.    
  3.     private T real;
  4.     private U imaginary;
  5.    
  6.     public ComplexNumber(T real, U imaginary) {
  7.         super();
  8.         this.real = real;
  9.         this.imaginary = imaginary;
  10.     }
  11.  
  12.     public T getR() {
  13.         return real;
  14.     }
  15.  
  16.     public U getI() {
  17.         return imaginary;
  18.     }
  19.    
  20.     public double modul(){
  21.        
  22.         return Math.sqrt(Math.pow(real.doubleValue(),2)+ Math.pow(imaginary.doubleValue(), 2));
  23.        
  24.     }
  25.    
  26.    
  27.    
  28.     public int compareTo(ComplexNumber<?, ?> o){
  29.        
  30.         //HELP HERE
  31.     }
  32.  
  33.    
  34.    
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement