Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1.     public Raha miinus(Raha vahennettava) {
  2.  
  3. 52
  4.          int eurot = this.euroa - vahennettava.eurot();
  5.  
  6. 53
  7.          int sentit = this.senttia - vahennettava.sentit();
  8.  
  9. 54
  10.  
  11.  
  12. 55
  13.          if (sentit < 0) {
  14.  
  15. 56
  16.              sentit = sentit + 100;
  17.  
  18. 57
  19.              eurot = eurot - 1;
  20.  
  21. 58
  22.          }
  23.  
  24. 59
  25.  
  26.  
  27. 60
  28.          // jos raha menisi negatiiviseksi, palautetaan nolla
  29.  
  30. 61
  31.          if (eurot < 0) {
  32.  
  33. 62
  34.              return new Raha(0, 0);
  35.  
  36. 63
  37.          }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement