Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can somebody write the following codes and write out the result? For the codes,

ID: 3595437 • Letter: C

Question

Can somebody write the following codes and write out the result? For the codes, please check it through ibm swift sandbox!

e squares of all the numbers in an array of Int's //Add the sum of th func sumSquares (values: [Int]) ->Int // even numbers in an array ->Int{ Add the sum of the squares of all SquaresEven (values: [Int]) //Given a dictionary of individuals Salaries (in whole //fi func averagesalary(salaries: [string: Int])->Int( nd the average salary //Given a dictionary of individuals Salaries (in whole dollars), //find the func averageSalary(salaries: [String: Int], testAmount: Int)->Int( average salary of all individuals who earn greater than a given amount //Given an array of doubles find the median //reminder: to sort an array use sort) func median (v: [Double])->Double ( //C nsider this function func mystery (info: [Int])->Int? var i 0 while (i Intf var sum = 0 var find: Int? for i in 0..

Explanation / Answer

Hi,
These are all separate questions, please post each one as separate questions as chegg doesnt allow to answer more than one question.
1. Mystery function
Solution: with the loop
while(i<info.count && info[i]%3==0)
i++
we are counting the number of elements in info that are divisible by 3, if all are divisible return nil, else return the number of divisble elements
hence mystery[3,12,15,4,18,21] will return 1 as 4 is not divisble
and mystery[3,12,15,33,18,21] will return nil as all are divisble

Thumbs up if this was helpful , otherwise let me know in comments