public class Commission
{
public static void main(String[] args)
{
double sales=50000.00;
double doubRate=.05;
int intRate=5;
computeCommission(sales,doubRate);
computeCommission(sales, intRate);
}
public void computeCommission(double sales,double rate)
{
commission=sales*doubRate;
System.out.println("Commission on sales of $" + sales +
"with a rate of " + doubRate + "= " + commission);
}
public void computeCommission(double sales,int rate)
{
commission=sales*(intRate*100);
System.out.println("Commission on sales of $ " + sales +
"with a rate of " + intRate + "% is " + commission);
}
}
I am to create a class with 3 variables: a double sales figure, a double commission rate, and an integer commission rate. Create 2 overloaded methods named computeCommission(). The first method will take two double arguments representing sales and rate, multiply them and display the results. The second method takes two arguments: 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. [b][i]also. I am to add a third overloaded method takes a single argument representing sales. When this method is called, the commission rate is assumed to be 7.5% and the results are displayed. To test this method, add an appropriate call in the Commission program's main () method.-----I haven't done this 3rd overloaded method because I cannot get the first two to compile and run. I keep getting errors and I just can't see them. What am I doing wrong.

New Topic/Question
Reply



MultiQuote




|