| Summary: | Creating user with negative balance | ||
|---|---|---|---|
| Product: | Group20 | Reporter: | Anders <agmller2-c> |
| Component: | User | Assignee: | awkakavou2-c |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | awkakavou2-c |
| Priority: | --- | ||
| Version: | 1.0 | ||
| Hardware: | PC | ||
| OS: | Linux | ||
|
Description
Anders
2019-11-05 17:49:13 HKT
I believe I have resolved the issue by "throwing" an exception when trying to add a user with a negative balance.
public User(String s, double d, int i) throws IllegalArgumentException {
// not relevant
if(d < 0)
throw new IllegalArgumentException("Negative balance");
else
this.balance = d;
// not relevant
}
Now when trying to create user with negative balance the message "Negative balance" is returned.
|