Search This Blog

If you have any problem or question please write in the comments. We will try to solve and send you the solution. Not just that we will also post your problems solution on our blog.

Sunday, 2 October 2011

Java program to calculate commission on sales using methods (by Adler Lawn Service,LLC)

 import java.util.*;
class commission2
{
public static void main (String args[])
{
Scanner in =new Scanner (System.in);
double sales_figure,commission_rate_d;
int commission_rate_i;
System.out.print ("\n\t Enter sales figure = ");
sales_figure=in.nextDouble();
System.out.print ("\n\t Enter first commission rate = ");
commission_rate_d=in.nextDouble();
System.out.print ("\n\t Enter second commission rate = ");
commission_rate_i=in.nextInt();
comm2 ob2 = new comm2();
totalcomm ob = new totalcomm();
ob.computeCommission(sales_figure,commission_rate_d);
ob.computecommission(sales_figure,commission_rate_i);
ob2.computeCommission(sales_figure);
}
}

class comm2 extends totalcomm
{
void computeCommission (double sales)
{
double cr;
cr=(7.5/100)*sales;
System.out.println ("\n\t Commission at 7.5% = "+cr);
}
}

class totalcomm
{
double sales_fig,comm_rate;
int com_rate;
void computeCommission(double p1, double p2)
{
sales_fig=p1;
comm_rate=p2;
System.out.println ("\n\t Sales commission = "+(sales_fig*comm_rate));
}
void computecommission(double p1, int p2)
{
sales_fig=p1;
com_rate=p2/100;
System.out.println ("\n\t Commission = "+(sales_fig*com_rate));
}
}

5 comments:

  1. I need a java program to do the following:

    Every salesperson has a basic salary.the salesperson also receives a bonus at the end of each month based on the following;

    if the salesperson has work for 5 years or less,the bonus is $10 for each year he has work there.
    if the salesperson has work more than 5 years, the bonus is $20 for each year he has work there.
    the sales person can earn additional bonus :
    if the total sale made by the salesperson for the month are greater than or equal to $5,000 but less than $10,000, he get 3% commission on the sale.
    if the total sale made by the salesperson for the month are $10,000 or more, he get 6% commission on the sale.

    ReplyDelete
  2. Nice, I have problem to solve this question: A large insurance company in USA pays its sales agent on a commission basis. The sales agent receives N$600 per week plus 20% of the gross sales for that week. For example a sales agent who sells N$8000 worth of insurance plans in a week receives N$600 plus 30% of N$8000. Write a Java Program to displays the sales agent salary per week and the salary per month. The salary per month is calculated as salary per week times four. can someone help me to solve please!

    ReplyDelete
  3. I need a java program about this problem of Sales Commission Calculator.

    A large company pays its salespeople on a commission basis. The salesperson receive $200 per week plus 9% of their gross sales for that week. For example, a salesperson who sells $5000 worth of merchandise in a week receives $200 plus 9% of $5000, or a total of $650. You've been supplied with a list of the items sold by each salesperson. The values of these are as follows:
    Item Value
    1. 239.99
    2. 129.75
    3. 99.95
    4. 350.89

    Develop a Java application that inputs one salesperson's items sold for last week and calculates and displays that salesperson's earnings. There's no limit to the number of items that can be sold.

    ReplyDelete
    Replies
    1. import java .util.*;

      public class Salary {

      public static void main(String[] args)
      {
      float sdollars,salary;
      int choice=1;
      Scanner input=new Scanner(System.in);
      while(choice==1)
      {
      System.out.println("Enter sales in dollars:");
      sdollars=input.nextFloat();
      sdollars=(sdollars*9)/100;
      salary=200+sdollars;
      System.out.printf("Salary is: %.2f\n",salary);
      System.out.println("Do you want to enter another data?(1 for yes & 0 for no)");
      choice=input.nextInt();
      }//while ends
      }}

      Delete
  4. but if i want to get multyple input and then calculatethen what logic is applied..?

    ReplyDelete