The constructor of the SalaryBonus class below makes the following assumptions;

You should add assert statements to the constructor that check for these preconditions.

The check method uses exception handling, a technique introduced in Chapter 11 of the text, to check that you inserted the appropriate assert statements. You need not understand the implementation of the check method at this time, and you should not modify it.

Complete the following file:

/** Calculate the salary amount by applying a bonus rate. */ public class SalaryBonus { private double salary; private double bonusRate; public SalaryBonus(double aSalary, double aRate) { //TODO: Add assert statements salary = aSalary; bonusRate = aRate; } /** The following method checks your constructor. We use the exception handling mechanism (see chapter 11) to determine whether (a) the constructor completed normally, (b) your code used an assertion to check a precondition violation, or (c) you failed to use an assertion and some other exception occurred. */ public static String check(double salaryTest, double rateTest) { try { SalaryBonus eBonus = new SalaryBonus(salaryTest,rateTest); return "Constructor completed normally"; } catch (AssertionError error) { return "Precondition violation detected"; } catch (Exception exception) { return "Exception in constructor"; } } }