A Java method cannot update primitive type parameters. For example, the following program cannot work as intended:

public class BonusTester
{
   public static void applyBonus(double value, double bonus)
   {
      value = value * (1 + bonus);
   }
   
   public static void main(String[] args)
   {
      double sal = 45000;
      applyBonus(sal, 0.02); // 2% bonus; cannot work
      System.out.println(sal); 
      System.out.println("Expected: 45900.0"); 
   }
}

To address this problem, the salary should be an object of a class.

Complete the following file:

Salary.java

/** A salary to which a bonus can be applied. */ public class Salary { . . . }

Use the following file:

BonusTester.java

public class BonusTester
{
   public static void main(String[] args)
   {
      Salary sal = new Salary(45000);
      sal.applyBonus(0.02); // 2% bonus
      System.out.println(sal.getValue());
      System.out.println("Expected: 45900.0"); // test success
   }
}