(int words, int seconds)
| 6 | |
| 7 | class ExceptionsDemo { |
| 8 | static double calculateWpm(int words, int seconds) throws InvalidDurationException { |
| 9 | if (seconds <= 0) { |
| 10 | throw new InvalidDurationException("seconds must be greater than 0"); |
| 11 | } |
| 12 | return (words * 60.0) / seconds; |
| 13 | } |
| 14 | |
| 15 | public static void main(String[] args) { |
| 16 | try { |