SHOW:
|
|
- or go back to the newest paste.
| 1 | <?php | |
| 2 | /** | |
| 3 | * @param <type> $NewEmployee Object | |
| 4 | * @return ınt | |
| 5 | * Please review the following function and create a NewEmployee Class with the desired attributes filled with suitable values (boolen or integer 1-10 , only experienceyears is an exception) to gain the maximum points | |
| 6 | * from the CalculateNewEmployeePoints and send the proper code to us with your CV. | |
| 7 | */ | |
| 8 | function CalculateNewEmployeePoints($NewEmployee) {
| |
| 9 | $totalPoints = 0; | |
| 10 | foreach($NewEmployee as $key => $value) {
| |
| 11 | switch ($key) {
| |
| 12 | case "graduatedengineering": | |
| 13 | if($value===true) | |
| 14 | $totalPoints+=10; | |
| 15 | break; | |
| 16 | case "teamplayer": | |
| 17 | if($value===true) | |
| 18 | $totalPoints+=10; | |
| 19 | break; | |
| 20 | case "abilitytosolvelastminuteproblems": | |
| 21 | if($value===true) | |
| 22 | $totalPoints+=10; | |
| 23 | break; | |
| 24 | case "militaryobligation": | |
| 25 | if($value===false) | |
| 26 | $totalPoints+=10; | |
| 27 | break; | |
| 28 | case "workedinsimilarprojects": | |
| 29 | if($value===true) | |
| 30 | $totalPoints+=5; | |
| 31 | break; | |
| 32 | case "industryaware": | |
| 33 | if($value===true) | |
| 34 | $totalPoints+=5; | |
| 35 | break; | |
| 36 | case "keenonmobileapps": | |
| 37 | if($value===true) | |
| 38 | $totalPoints+=5; | |
| 39 | break; | |
| 40 | case "experienceyears": | |
| 41 | if(is_int($value)) | |
| 42 | $totalPoints+=($value*5); | |
| 43 | break; | |
| 44 | default: | |
| 45 | /** Other characteristics, | |
| 46 | * "phpknowledge" | |
| 47 | * "sqlknowledge" | |
| 48 | * "linuxknowledge" | |
| 49 | * "xhmtlknowledge" | |
| 50 | * "cssknowldge" | |
| 51 | * "jqueryknowledge" | |
| 52 | * "englishknowledge" | |
| 53 | * "creativity" | |
| 54 | * "seoknowledge" | |
| 55 | */ | |
| 56 | if($value>10) $value=10; | |
| 57 | $totalPoints+=$value; | |
| 58 | break; | |
| 59 | } | |
| 60 | } | |
| 61 | return $totalPoints; | |
| 62 | } | |
| 63 | ?> |