Add Bonus Apex class
This commit is contained in:
32
force-app/main/default/classes/Bonus.cls
Normal file
32
force-app/main/default/classes/Bonus.cls
Normal file
@@ -0,0 +1,32 @@
|
||||
public class Bonus
|
||||
{
|
||||
|
||||
public static Map<String,Decimal> calculate(List <String>employee,Decimal salesamount)
|
||||
{
|
||||
Decimal bonus,Bonusamount;
|
||||
if(salesamount>100000)
|
||||
{
|
||||
bonus=0.2;
|
||||
}
|
||||
else
|
||||
{
|
||||
bonus=0.1;
|
||||
}
|
||||
Bonusamount=bonus*salesamount;
|
||||
|
||||
Map <String,Decimal> k=new Map<String,Decimal>();
|
||||
for(Integer i=0;i<employee.size();i++)
|
||||
{
|
||||
|
||||
k.put(employee.get(i),Bonusamount);
|
||||
}
|
||||
|
||||
return k;
|
||||
}
|
||||
public static void show()
|
||||
{
|
||||
List <String> l=new List<String>{'Aman','Arpit','Naveen','Lokesh'};
|
||||
System.debug(calculate(l,150000));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user