-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.dart
81 lines (43 loc) · 1.2 KB
/
test.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
sum(List x) {
var total = x.reduce((i, p) => i + p);
return total;
}
calcCoCapital(var coCapital, var percentage) {
var coCapitalAfterPerc = coCapital * percentage / 100;
return coCapitalAfterPerc;
}
salaryIncreament(List salaries, var incrValue) {
List salariesAfterInc = [];
for(var i in salaries){
i = i + ( i * incrValue / 100 );
salariesAfterInc.add(i);
}
return salariesAfterInc;
}
calSalariesInc(List salaries, var coCapital, var percentage, var newPercentage, var incValue) {
List salariesInc = salaryIncreament(salaries, incValue);
var sumValue = sum(salariesInc);
var coCapitalCal = calcCoCapital(coCapital, percentage);
if(sumValue > coCapitalCal){
List salariesIncssss = salaryIncreament(salaries, incValue - newPercentage);
print('im in if $salariesIncssss');
}else{
print('im in else $salariesInc');
}
}
void main() {
//List salary = [2000, 10000, 2000, 5000];
List salary = fun();
var perc = 25;
var modifyPerc = 5;
var coCapital = 10000000;
var incValue = 10;
calSalariesInc(salary, coCapital, perc, modifyPerc, incValue);
}
fun() {
List x = [];
for(int i = 0; i < 100000; i++){
x.add(i);
}
return x;
}