Thu Nov 03, 2011 6:35 pm
import java.util.Scanner;
public class Commission {
public static void main(String[] args){
Commission cs=new Commission();
// method 1 = 2 parameters = double, double
cs.computeCommission(0.0-100000.0,.00-.100);
// method 2 = 2 parameters = double, integer
cs.computeCommission(0.0-100000.0,(0-100)/100);
//method 3 = 1 parameter = double
cs.computeCommission(100000.1-1000000);
}
//creating method 1
void computeCommission (double rate, double salesFigure)
{
Scanner input = new Scanner(System.in);
System.out.println(" Enter your total sales amount ");
salesFigure = input.nextDouble();
System.out.println(" Enter your commission rate ");
rate = input.nextDouble();
double computeCommission;
computeCommission = salesFigure * rate;
System.out.println(" Your commission is $ " + computeCommission);
}
//creating method 2
void computeCommission ( double salesFigure2,int commissionRate)
{
Scanner input = new Scanner(System.in);
System.out.println(" Enter your total sales amount ");
salesFigure2 = input.nextDouble();
System.out.println(" Enter your commission rate ");
commissionRate= input.nextInt();
double computeCommission;
computeCommission = salesFigure2 * ( commissionRate/ 100);
System.out.println(" Your commission is $ " + computeCommission);
}
//creating method 3
void computeCommission (double salesFigure3)
{
Scanner input = new Scanner(System.in);
System.out.println(" Enter your total sales amount ");
salesFigure3 = input.nextDouble() * .075;
System.out.println(" Your commission is $ " + salesFigure3);
}
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.