Exercise:
Create a Class named Commission that includes three Variables: a double sales figure, a double commission rate, and an int commission rate. Create two overloaded methods named computeCommission( ). The first method takes two double parameters representing sales and rate, multiplies them, and then displays the results. The second commission takes two parameters: a double sales figure and an integer commission rate. This method must divide the commission rate by 100.0 before multiplying by the sales figure and displaying the commission. Supply appropriate values for the variables, and write a main( ) method that tests each overloaded method. Save the application as Commission.java.
Does this code do what the exercise wants?
public class Commission { public static void main(String[] args) { double Sales = 2000.75; double Rate = 15.50; int rate = 16; computeCommission(Sales, Rate); computeCommission(Sales, rate); } public static void computeCommission(double Sales, double Rate) { System.out.println("Total Sales Commission this Term: " + (Sales * Rate)); } public static void computeCommission(double Sales, int rate) { System.out.println("Today's Sales Commission: " + ((rate / 100.0) * Sales)); } }