Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void transfer(int fromCode, int toCode, int date, double value)
- throws InvalidCode, InvalidValue {
- if (!accounts.containsKey(fromCode) || !accounts.containsKey(toCode)) {
- throw new InvalidCode();
- }
- double s = accounts.get(fromCode).getValue();
- //if (s > accounts.get(toCode).getValue()) {
- if (value > s){
- throw new InvalidValue();
- } else {
- double t = accounts.get(toCode).getValue();
- t += s;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement