Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ExceptionExample {
- public static void main(String[] args) {
- System.out.println(calculateSalary(8, 3));
- }
- public static double calculateSalary(int hours, double hourRate) {
- if(hours < 0) {
- throw new IllegalArgumentException("Tundide arv ei tohi olla negatiivne. Sisend oli " + hours);
- }
- /*if(hourRate < 0) {
- throw new IllegalArgumentException("Tunnitasu ei tohi olla negatiivne. Sisend oli " + hourRate);
- }
- if(hourRate < 2.97) {
- throw new IllegalArgumentException("Tunnitasu ei tohi alla miinimumi 2.97. Sisend oli " + hourRate);
- }*/
- if(hourRate < 2.97) {
- throw new IllegalArgumentException("Tunnitasu ei tohi olla negatiivne v�i alla miinimumpalga. Sisend oli " + hourRate);
- }
- return hours * hourRate;
- }
- }
Add Comment
Please, Sign In to add comment