1. Write a java program to accept monthly sales and print commission for
the salesman
Sales (Rs.)
Commission
Upto Rs. 5000
nil
> Rs. 5000 and upto Rs. 10000
12%
> Rs. 10000 and upto Rs. 15000
15%
> Rs. 15000
18%
Apart from this, each salesman gets travelling allowance of Rs. 1500. Display
the total income of each salesman along with the sales.
Answers
Answer:
import java.util.Scanner;
class HelloWorld {
public static void main(String[] args) {
int monthlySales, travelAllowance=1500;
double commission=0.00, totalIncome;
Scanner sales= new Scanner(System.in);
monthlySales= sales.nextInt();
if(monthlySales<=5000){
System.out.println("commission NIL");
}else if(monthlySales>5000 && monthlySales<=10000){
commission = (0.12 * monthlySales);
}else if(monthlySales>10000 && monthlySales<=15000){
commission = (0.15 * monthlySales);
}else{
commission = (0.18 * monthlySales);
}
totalIncome = commission + travelAllowance;
System.out.println("total income for " + monthlySales + " Sales is "+totalIncome);
}
}
Explanation: