Add Bonus Apex class

This commit is contained in:
unknown
2026-01-28 13:45:17 +05:30
parent c0b8be12ac
commit aa2b549333
2 changed files with 37 additions and 0 deletions

View 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));
}
}