Question 7
Consider the following java code
class Interest{ //p = Principal Amount, r = Rate per Annum, t = Time (years) private double p, t, r; public Interest(double p, double t, double r) { this.p = p; this.t = t; this.r = r; } public double calculate() { assert p * t * r > 0; // assert-1 assert p > 0; // assert-2 assert t > 0; // assert-3 assert r > 0; // assert-4 return (p * t * r / 100); }}public class AssertTest { public static void main(String[] args) { Interest obj = new Interest(5000.00, -1.00, -16.56); System.out.println(obj.calculate()); }}Identify the first assert statement that throws the AssertionError when the class is executed as:
java -ea AssertTest
assert-1
assert-2
assert-3
assert-4