Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

how would i throw the illegal argument exception(source code): all are used in a

ID: 3637092 • Letter: H

Question

how would i throw the illegal argument exception(source code):
all are used in a program that finds the deviation, indexofsmallestelement, and mean of 10 input numbers. all i need to know is how to write the source code to throw the illegal argument for the following---

Throws:
IllegalArgumentException - if there are less than 2 values

Throws:
IllegalArgumentException - if the list is empty(an array)

Throws:
IllegalArgumentException - if there are no values

Explanation / Answer

In general: if (condition) throw new IllegalArgumentException("condition not satisfied"); example if (n < 0) throw new IllegalArgumentException("n must be positive"); if (n >= 60) throw new IllegalArgumentException("n must be < 60"); RATE ME LIFESAVER!!!