Advertisement
spiny94

Untitled

Sep 11th, 2015
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.44 KB | None | 0 0
  1. public void transfer(int fromCode, int toCode, int date, double value)
  2.             throws InvalidCode, InvalidValue {
  3.         if (!accounts.containsKey(fromCode) || !accounts.containsKey(toCode)) {
  4.             throw new InvalidCode();
  5.         }
  6.  
  7.         double s = accounts.get(fromCode).getValue();
  8.        
  9.         //if (s > accounts.get(toCode).getValue()) {
  10.         if (value > s){
  11.         throw new InvalidValue();
  12.         } else {
  13.             double t = accounts.get(toCode).getValue();
  14.             t += s;
  15.  
  16.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement