Question: use language swift and please test this in swift ibm sandbox to check it. Thanks. Write and test the following functions: /Given an array of

use language swift and please test this in swift ibm sandbox to check it. Thanks.

use language swift and please test this in swift ibm sandbox to

Write and test the following functions: /Given an array of integers, tind the tirst index in the array that matches //a given number, Return nil if there is no match funo findNumberInArray (data: (Int), numbertorind: Int)->Int? // return the sum of the squares of the elements of a Double azray funo sumsquares (data: [Double)- Double /Given a single Int digit return its english name. Return "number is not a digit" i the given //Int is not a digit funo returnDigitName (digit: Int)-string on your age. If your //A movie theater has an odd ticked pricing method. It depends /age is between 5 -10, the price is 1/2 of your age. If your age is between 30 the price is 1/3 of your age. If your age is between 31 and 60, //the price is 1/5 of your age. Else the ticket is $5 //Hint: Convert the age to a Double before doing calculations fune computesillyTicketPrice (age: Int)-> Double Test Code: let datal (12, 34, 17, 10, , 6) print (findNumberInArray (datal, numberToFind: 10) print (findNumberInArray (datal, numberToFind: 20) print (sumSquares ((3.0 4.0. 5.0)) print (returnDigitName (2) print (returnDigitName(8) print (returnDigitName (12)) print (computesillyTicketPrice(8) print (computeSillyTicketPrice (15)) print (computesillyTicketPrice (40) print (computeSillyTicketPrice (62)) Expected output: Optional (3) nil 50.0 tHO eight 12 is not a digit 4.0 Write and test the following functions: /Given an array of integers, tind the tirst index in the array that matches //a given number, Return nil if there is no match funo findNumberInArray (data: (Int), numbertorind: Int)->Int? // return the sum of the squares of the elements of a Double azray funo sumsquares (data: [Double)- Double /Given a single Int digit return its english name. Return "number is not a digit" i the given //Int is not a digit funo returnDigitName (digit: Int)-string on your age. If your //A movie theater has an odd ticked pricing method. It depends /age is between 5 -10, the price is 1/2 of your age. If your age is between 30 the price is 1/3 of your age. If your age is between 31 and 60, //the price is 1/5 of your age. Else the ticket is $5 //Hint: Convert the age to a Double before doing calculations fune computesillyTicketPrice (age: Int)-> Double Test Code: let datal (12, 34, 17, 10, , 6) print (findNumberInArray (datal, numberToFind: 10) print (findNumberInArray (datal, numberToFind: 20) print (sumSquares ((3.0 4.0. 5.0)) print (returnDigitName (2) print (returnDigitName(8) print (returnDigitName (12)) print (computesillyTicketPrice(8) print (computeSillyTicketPrice (15)) print (computesillyTicketPrice (40) print (computeSillyTicketPrice (62)) Expected output: Optional (3) nil 50.0 tHO eight 12 is not a digit 4.0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!