Search This Blog

UI/UX Design | Web Development | Mobile Application Development

Whether you need UI/ UX design, web development services, or mobile app development services, Qaabil Digitals will be more than happy to help you. We work with top software developers, designers, and project managers. We tailor our services to suit your exact needs. We closely look at your company, listen to your story, and bring about the best ideas and solutions that can help you drive solid results. We don’t just produce work that works. We produce work that matters. Get a quote now Or Talk to us

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));
}
}

12 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
    2. dude this program isn't compiling

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

    ReplyDelete
  5. Question 1 (55 Marks)
    Write a complete Java program using enum to calculate total monthly income for Hanis Tourist Agent. You must write two complete Java programs, Agent.java and TestAgent.java based on the instruction given in (a) and (b).
    a) Write a class named Agent. The class uses enum data type and should have a double field named cost that holds the travelling cost and a double field named commission that holds the commission rate. There are four packages offered by Hanis Tourist Agent as shown in Table 1.
    Table 1: Hanis Tourist Agent package
    Package
    Package Offered
    Commission Rate
    Nilam
    RM 2020.00/person for 5D4N Adelaide
    14% per cost per person
    Aqiq
    RM 1440.00/person for 5D4N Gold Coast
    8% per cost per person
    Delima
    RM 1490.00/person for 5D4N Melbourne
    10% per cost per person
    Zamrud
    RM 2075.00/person for 5D4N Perth
    15% per cost per person
    In addition, the class also provides the following methods:
    (i) A constructor for class Agent that accepts the travelling cost and the commission rate as the arguments. It should set the cost field and commission field to the value passed as the arguments.
    (ii) Write suitable code for the getter (accessor) methods.
    (iii) Write method named readInput() to read input for numPerson from keyboard. The variable holds the number of person for each package. Use Scanner class for this purpose.
    (iv) Write method named calcCommission()to return the total commission will be received for each package.
    b) Write a class TestAgent that only has main() method with the following codes:
    (i) Ask the user to enter input for numOrder from keyboard. The variable holds the number of package ordered by customer.
    (ii) Creates Agent objects based on numOrder entered by user.
    (iii) Read input for each object created.
    (iv) Calculate and display the total monthly income will be received for all ordered packages.



    The program should produce the output as shown in Figure 1(a) and 1(b). Note that the text in bold indicates input entered by the user.

    Number of package ordered: 2
    Package [NILAM, AQIQ, DELIMA, ZAMRUD]
    Package [1]
    Package type: Delima
    Package info: RM 1490.00/person for 5D4N Melbourne
    Commission rate: 10.0% per total cost
    Number of person(s): 4
    Total cost: RM5960.00
    Total commission: RM596.00
    Package [2]
    Package type: AQIQ
    Package info: RM 1440.00/person for 5D4N Gold Coast
    Commission rate: 8.0% per total cost
    Number of person(s): 6
    Total cost: RM8640.00
    Total commission: RM691.20
    TOTAL INCOME: RM1287.20
    Press any key to continue . . .

    ReplyDelete
  6. At the University of Palompon, every unit is worth P45 in enrollment fees. An additional 15% of this amount is paid in miscellaneous fees with a blanket fee of P200 regardless of the load. Write a program to input the number of UNITS a student is enrolled and output the TUTION FEE to be paid.

    ReplyDelete
  7. Take as input the student’s grades of seven subjects and its corresponding unit taken in a semester. A student is considered failed if the average grade is less than 3.0. Compute the student’s General Point Average (GPA) by multiplying the grade per subject by its corresponding unit, sum up the products and divide the sum by its total units. Print the computed average grade and whether the student “failed” or “passed”.

    ReplyDelete
  8. A company selling household appliances gives commissions to its salesman determined by the kind of product sold as well as the sales amount.
                    Type 1: 7% of sale or 400, whichever is more.
                    Type 2: 10% of sale or 900, whichever is less.
                    Type 3: 12% of sale.
                    Type 4: P250, regardless of sale price.
                    Make a program that would input the TYPE of appliance sold (between 1-4) and the sale PRICE (a positive floating-point value), and output the COMMission that the salesman will receive.

    ReplyDelete
  9. The goals scored in a soccer match may be input as a sequence of 1s and 2s terminated by 0. The number 1 would mean that team 1 made a goal and 2 would mean that team 2 made a goal. Thus the sequence 1 2 1 2 1 1 2 0 means that Team 1 made 4 goals and team 2 made 3 goals in all. Write a program that would input such sequence and output how many goals each team made and the result of the match (“Team 1 won”, ”Team 2 won”, “Both tied”). Ensure that inputs are 0,1 and 2 only.

    ReplyDelete
  10. Use a single-subscripted array to solve the following problem. A company pays its salespeople on a commission basis. The salespeople receive Php200 per week plus 9 percent of their gross sales for the week. For example, a salesperson who grosses Php3000 in sales in a week receives Php200 plus 9 percent of Php3000, or a total of Php470. Write a C program that determines how many of the 10 salespeople earned salaries which is more than Php500.

    ReplyDelete

Share