Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.16 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package zadanie4;
  7.  
  8. /**
  9.  *
  10.  * @author peroxicz
  11.  */
  12. public class Rzeczywiste {
  13.    
  14.     public double real;
  15.    
  16.    
  17.     public Rzeczywiste(double real){
  18.         this.real=real;
  19.     }
  20.    
  21.    
  22.     public void setReal(double real) {
  23.         this.real = real;
  24.     }
  25.    
  26.    
  27.    
  28.     public Rzeczywiste Dodaj(Rzeczywiste A){
  29.    
  30.         return new Rzeczywiste(this.real + A.real);
  31.     }
  32.    
  33.     public Rzeczywiste Odejmij(Rzeczywiste A){
  34.        
  35.         return new Rzeczywiste(this.real - A.real);
  36.     }
  37.    
  38.     public Rzeczywiste Pomnoz(Rzeczywiste A){
  39.        
  40.         return new Rzeczywiste(this.real * A.real);
  41.     }
  42.    
  43.     public Rzeczywiste Podziel(Rzeczywiste A){
  44.        
  45.         return new Rzeczywiste(this.real / A.real);
  46.     }
  47.    
  48.     public Rzeczywiste Kwadrat(Rzeczywiste A){
  49.        
  50.         return new Rzeczywiste(this.real*this.real);
  51.     }
  52.    
  53.     public double getReal() {
  54.         return real;
  55.     }
  56.    
  57.    
  58.    
  59.    
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement