Question: I am able to easily create dictionary mapping from string to float (part 1). Having difficulty taking in dictionary as parameter of functions and calling

I am able to easily create dictionary mapping from string to floatI am able to easily create dictionary mapping from string to float (part 1). Having difficulty taking in dictionary as parameter of functions and calling function with the dictionary. Still learning Swift syntax. Thank you for any help with part 2!

Problem Write a Playground file in Swift to 1. Create a dictionary for at least 5 products, in which each key is a product name (e.g., "Stawberry Icecream) and each value is a tuple including the category and price of the corresponding product (e.g., (Dissert, 3.99)) 2. Declare three functions: lowestPrice function returns name and price of the product that has the lowest price among all given products. highestPrice function returns name and price of the product that has the highest price among all given products. price function takes a product dictionary and a reference to a function as arguments. It returns the information (i.e., product name and price of the product that has either the lowest price or the highest price. Problem Write a Playground file in Swift to 1. Create a dictionary for at least 5 products, in which each key is a product name (e.g., "Stawberry Icecream) and each value is a tuple including the category and price of the corresponding product (e.g., (Dissert, 3.99)) 2. Declare three functions: lowestPrice function returns name and price of the product that has the lowest price among all given products. highestPrice function returns name and price of the product that has the highest price among all given products. price function takes a product dictionary and a reference to a function as arguments. It returns the information (i.e., product name and price of the product that has either the lowest price or the highest price

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!