Input name, salary and sales amount of a sales executive. Find his incentive and gross income.
Incentive rate is 5% of the sales amount that exceeds 500000 (Consider that the sales amount is above 500000).
Print all details. Gross income=salary+incentive.
import java.util.*;
public class Number
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter name, salary and sales amount");
String na=sc.nextLine();
double sal=sc.nextDouble();
double amt=sc.nextDouble();
double incentive=5/100.0*amt;
double gross=amt+sal+incentive;
System.out.println("Name: "+na);
System.out.println("Salary: "+sal);
System.out.println("Sales Amount: "+amt);
System.out.println("Incentive: "+incentive);
System.out.println("Gross income: "+gross);
}
}
2.1.
Input salary and sales amount of a sales executive. Find his incentive and gross salary.
If the sales amount is above 500000 then incentive is 8% of the sales amount that exceeds 500000.
Print salary, sales amount, incentive and gross salary.
import java.util.*;
public class Number
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter salary and sales amount");
double sal=sc.nextDouble();
double amt=sc.nextDouble();
double incentive=0.0;
if(amt>=500000)
incentive=8/100.0*(amt-500000);
double gross=amt+sal+incentive;
System.out.println("Salary: "+sal);
System.out.println("Sales Amount: "+amt);
System.out.println("Incentive: "+incentive);
System.out.println("Gross income: "+gross);
}
}
2.2.
Input salary and sales amount of a sales executive. Find his incentive and gross salary.
If the sales amount is above 500000 then incentive is 10000 + 8% of the sales amount that
exceeds 500000, otherwise 2% of the sales amount. Print salary, sales amount, incentive and gross salary.
import java.util.*;
public class Number
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter salary and sales amount");
double sal=sc.nextDouble();
double amt=sc.nextDouble();
double incentive;
if(amt>=500000)
incentive=10000+8/100.0*(amt-500000);
else
incentive=2/100.0*amt;
double gross=amt+sal+incentive;
System.out.println("Salary: "+sal);
System.out.println("Sales Amount: "+amt);
System.out.println("Incentive: "+incentive);
System.out.println("Gross income: "+gross);
}
}
2.3.
Input salary and sales amount. Find incentive and gross salary; print them along with salary and sales amount.
If sales amount is above 1000000 then incentive is 50000 + 10% of the amount that exceeds 1000000.
If sales amount is above 500000 then 10000 + 8% of the amount that exceeds 500000, else 2%.
import java.util.*;
public class Number
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter salary and sales amount");
double sal=sc.nextDouble();
double amt=sc.nextDouble();
double incentive;
if(amt>1000000)
incentive=5000+10/100.0*(amt-1000000);
else if(amt>500000)
incentive=10000+8/100.0*(amt-500000);
else
incentive=2/100.0*amt;
double gross=amt+sal+incentive;
System.out.println("Salary: "+sal);
System.out.println("Sales Amount: "+amt);
System.out.println("Incentive: "+incentive);
System.out.println("Gross income: "+gross);
}
}
2.4.
Input salary, sales amount and years of service. Find incentive and gross salary. The incentive is calculated
on sales amount. The rate is given below:
Amount Service above 5 yrs Service 5 yrs or below
1000000 or above 11% 10%
500000 or above 9% 8%
Below 500000 3% 2%
import java.util.*;
public class Salary
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter salary, sales amount and years of service");
double sal=sc.nextDouble();
double amt=sc.nextDouble();
int service=sc.nextInt();
double inc;
if(service>5)
{
if(amt>=1000000)
inc=amt*11/100.0;
else if(amt>=500000)
inc=amt*9/100.0;
else
inc=amt*3/100.0;
}
else if(service<=5)
{
if(amt>=1000000)
inc=amt*10/100.0;
else if(amt>=500000)
inc=amt*8/100.0;
else
inc=amt*2/100.0;
}
double gross=sal+inc;
System.out.println("Salary: "+ sal);
System.out.println("Sales Amount: "+ amt);
System.out.println("Incentive: "+inc);
System.out.println("Gross salary: "+gross);
}
}
2.5.
Write a menu-driven program:
1) Calculate incentive and total salary. Rate is 10% on the sales amount
2) Calculate Life Insurance deduction and Remaining salary. Rate is 12% on the salary.
import java.util.*;
public class Salary
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("1 Incentive");
System.out.println("2 Life Insurance");
System.out.println("Enter your choice");
int ch=sc.nextInt();
double salary,amt,incentive,insurance,tot,net;
switch(ch)
{
case 1: System.out.println("Enter salary and sales amount");
salary=sc.nextDouble();
amt=sc.nextDouble();
incentive=amt*10/100.0;
tot=salary+incentive;
System.out.println("Incentive: "+incentive);
System.out.println("Total salary: "+tot);
break;
case 2: System.out.println("Enter salary");
sal=sc.nextDouble();
insurance=salary*12/100.0;
net=salary-insurance;
System.out.println("Insurance: "+insurance);
System.out.println("Net Salary: "+net);
break;
default: System.out.println("Wrong input");
)
}
}
3.1.
Input name, salary and sales amount of n sales executives. Find their incentive and gross salary.
If the sales amount is above 500000 then incentive is 8% of the sales amount that exceeds 500000. Otherwise 2%.
Print salary, sales amount, incentive and gross salary for each employee. Also find grand total of salaries. Format is given below:
Sl.No.NameSalaryAmountIncentiveGross salary
1xxxxxxxxxxxxxxx
Grand total of salaries: xxx
import java.util.*;
public class salary
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter number of sales executives");
int n=sc.nextInt();
double gtot=0.0;
for(int i=1;i<=n;i++)
{
System.out.println("Enter name, salary and sales amount");