Write a java program to calculate the commission of a salesman of book and net salary as per following data by taking input as salesman name, sales and basic salary. Sales Commission >=100000 25%80000 to 99999 22% 60000 to 79999 20% 40000 to 59999 15% <40000 12%Print the output in following format Name Sales Commission Net Salary _____ _____ _________ ________xx xx xx xx" WRITE INPUT, OUTPUT AND VARIABLE DESCRIPTION TABLE "​

Answers 2

Answer:

import java.util.Scanner;

public class test {

   public static void main(String[] args) {

       System.out.println("Enter salary");

       Scanner sc = new Scanner(System.in);

       float salary = sc.nextFloat();

       sc.close();

       if (salary >= 100000) {

           System.out.println("Sales commision is 25%");    

           double moneyInSalesCommision = (salary/25.0) * 100;

           System.out.println("Money in sales commision is " + moneyInSalesCommision);

           double moneyLeft = salary - moneyInSalesCommision;

           System.out.println("Money left is " + moneyLeft);

       } else if (salary >= 80000 && salary <= 99999) {

           System.out.println("Sales commision is 22%");    

           double moneyInSalesCommision = (salary/22.0) * 100;

           System.out.println("Money in sales commision is " + moneyInSalesCommision);

           double moneyLeft = salary - moneyInSalesCommision;

           System.out.println("Money left is " + moneyLeft);

       } else if (salary >= 60000 && salary <= 79999) {

           System.out.println("Sales commision is 20%");    

           double moneyInSalesCommision = (salary/20.0) * 100;

           System.out.println("Money in sales commision is " + moneyInSalesCommision);

           double moneyLeft = salary - moneyInSalesCommision;

           System.out.println("Money left is " + moneyLeft);

       } else if (salary >= 40000 && salary <= 59999) {

           System.out.println("Sales commision is 15%");    

           double moneyInSalesCommision = (salary/15.0) * 100;

           System.out.println("Money in sales commision is " + moneyInSalesCommision);

           double moneyLeft = salary - moneyInSalesCommision;

           System.out.println("Money left is " + moneyLeft);

       } else if (salary < 40000) {

           System.out.println("Sales commision is 12%");    

           double moneyInSalesCommision = (salary/12.0) * 100;

           System.out.println("Money in sales commision is " + moneyInSalesCommision);

           double moneyLeft = salary - moneyInSalesCommision;

           System.out.println("Money left is " + moneyLeft);

       }

   }

}

Explanation:

Please mark it as the brainliest

Hope it helps ^_^The question wasn't clear, it would have been better if you had provided an example of how the output should be.I am printing the commission by taking sales as input._____________________________________

import java.util.Scanner;

public class Salesman_Ki_Commission{

   public static void main(String [] args){

       Scanner sc = new Scanner(System.in);

       double sales, commission = 0;

       // Printing the useless commission-rate table

       System.out.println("This program calculates the commission earned by the salesman by taking sales as input");

       System.out.println("");

       System.out.println("This is the rate of commission");

       System.out.println("     Sales     " + "       Commission(%)");

       System.out.println("Sales >= 100000     " + "      25%      ");

       System.out.println("Sales >= 80000      " + "      22%      ");

       System.out.println("Sales >= 60000      " + "      20%      ");

       System.out.println("Sales >= 40000      " + "      15%      ");

       System.out.println("Sales < 40000       " + "      12%      ");

       System.out.println("");

       // Taking input from the user

       System.out.print("Enter the name: ");

       String name = sc.nextLine();

       System.out.print("Enter the sales: ");

       sales = sc.nextDouble();

       // Most important part comes here

       if (sales >= 100000)

       commission = 0.25 * sales;

       else if (sales >= 80000 && sales < 100000)

       commission = 0.22 * sales;

       else if (sales >=60000 && sales < 80000)

       commission = 0.2 * sales;

       else if (sales >= 40000 && sales < 60000)

       commission = 0.15 * sales;

       else

       commission = 0.12 * sales;

       // Printing the output

       System.out.println("The total commission earned by " + name + ": " + commission);

   }

}

_____________________________________I added all the outputs to make the answer even lengthier (. ❛ ᴗ ❛.)Lengthy answers make me go brrrrrrrrrrrrrrrrrrrThe underlined part is the user-inputOutput:

(i)

This program calculates the commission earned by the salesman by taking sales as input

This is the rate of commission

    Sales            Commission(%)

Sales >= 100000           25%      

Sales >= 80000            22%      

Sales >= 60000            20%      

Sales >= 40000            15%      

Sales < 40000             12%      

Enter the name: Shivu

Enter the sales: 100000

The total commission earned by Shivu: 25000.0

(ii)

This program calculates the commission earned by the salesman by taking sales as input

This is the rate of commission

    Sales            Commission(%)

Sales >= 100000           25%      

Sales >= 80000            22%      

Sales >= 60000            20%      

Sales >= 40000            15%      

Sales < 40000             12%      

Enter the name: Shivu

Enter the sales: 80000

The total commission earned by Shivu: 17600.0

(iii)

This program calculates the commission earned by the salesman by taking sales as input

This is the rate of commission

    Sales            Commission(%)

Sales >= 100000           25%      

Sales >= 80000            22%      

Sales >= 60000            20%      

Sales >= 40000            15%      

Sales < 40000             12%      

Enter the name: Shivu

Enter the sales: 60000

The total commission earned by Shivu: 12000.0

(iv)

This program calculates the commission earned by the salesman by taking sales as input

This is the rate of commission

    Sales            Commission(%)

Sales >= 100000           25%      

Sales >= 80000            22%      

Sales >= 60000            20%      

Sales >= 40000            15%      

Sales < 40000             12%      

Enter the name: Shivu

Enter the sales: 40000

The total commission earned by Shivu: 6000.0

(v)

This program calculates the commission earned by the salesman by taking sales as input

This is the rate of commission

    Sales            Commission(%)

Sales >= 100000           25%      

Sales >= 80000            22%      

Sales >= 60000            20%      

Sales >= 40000            15%      

Sales < 40000             12%      

Enter the name: Shivu

Enter the sales: 150

The total commission earned by Shivu: 18.0

_____________________________________Hope you liked this lengthy answer

answer img

If you know the answer add it here!

Can't find the answer?

Log in with Google

or

Forgot your password?

I don't have an account, and I want to Register

Choose a language and a region
How much to ban the user?
1 hour 1 day 100 years