Pampour

Euro.java

Oct 25th, 2013
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.90 KB | None | 0 0
  1. public class Euro {
  2.    
  3.     private int eurocenten = 0;
  4.    
  5.     private void setEuro(int bedrag) {
  6.         if (bedrag >= 0) {
  7.             this.eurocenten = bedrag*100;
  8.         }
  9.     }
  10.    
  11.     private void setEC(int bedrag) {
  12.         if (bedrag >= 0) {
  13.             this.eurocenten = bedrag;
  14.         }
  15.     }
  16.    
  17.     public int getEuro() {
  18.         return this.eurocenten/100;
  19.     }
  20.    
  21.     public int getEC() {
  22.         return this.eurocenten;
  23.     }
  24.    
  25.     public Euro() {
  26.        
  27.     }
  28.    
  29.     public Euro(int euro) {
  30.         this.setEuro(euro);
  31.     }
  32.    
  33.     public Euro(int euro, int ec) {
  34.         this.setEuro(euro);
  35.         this.setEC(this.getEC()+ec);
  36.     }
  37.    
  38.     public boolean zelfdeBedrag(Euro other) {
  39.         if (other != null && this.getEC()==this.getEC()) {
  40.             return true;
  41.         }
  42.         return false;
  43.     }
  44.    
  45.     public boolean isMinder(Euro other) {
  46.         if (other != null && this.getEC() < other.getEC()) {
  47.             return true;
  48.         }
  49.         return false;
  50.     }
  51.    
  52.     public String toString() {
  53.         return this.getEC() + " eurocenten";
  54.     }  
  55. }
Advertisement
Add Comment
Please, Sign In to add comment