Subject:
Computer ScienceAuthor:
gloria38Created:
1 year agoAnswer:
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
Author:
kade5e1b
Rate an answer:
0import 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 answerAuthor:
slyriddle
Rate an answer:
13