i need to write a program for this test of java :

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 method takes two parameters: a double sales figure and an integer commission rate. this method must divide the commission rate figure 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.

What problem you are having in this?

See here:

// first function
static double computecommission(double s, double r)
	System.out.println("First function");
	return s*r;

// second fucntion
static double computecommission(double s, int commr)
	System.out.println("Second function");
	 commr= commr/100;
	return s*commr;

     // Call in main()
          double ans=computecommission(sales,rate);
	System.out.println("Answer: "+ ans);
	System.out.println("Answer: "+ ans);

For full working code, see here.

Hope it helps, any doubts, feel free to ask!!

1 Like