Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a MacOS Playground file in Swift to: 1 . Create a dictionary of products, in which each key is a product name (e.g., Strawberry

Write a MacOS Playground file in Swift to:

1. Create a dictionary of products, in which each key is a product name (e.g., Strawberry Ice Cream) and its value is a tuple including the category and price of the 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 two arguments:

a) a dictionary of products

b) a reference to a function

Function price should return the name and price of the product that has the lowest price, if a reference to function lowestPrice is passed as argument b).

Similarly, function price should return the name and price of the product that has the highest price, if a reference to function highestPrice is passed as argument b),

3. Include some necessary statements to test your work for steps 1 and 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Michael V. Mannino

4th Edition

0615231047, 978-0615231044

More Books

Students also viewed these Databases questions