Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Program is in Swift, please explain. Thank you! Objective: Practice programming with dictionaries, strings, loops, and functions. References: Sections 2.1 (Strings) and 2.5 (Collections) of
Program is in Swift, please explain. Thank you!
Objective: Practice programming with dictionaries, strings, loops, and functions. References: Sections 2.1 (Strings) and 2.5 (Collections) of "Application Development with Swift" You are given a dictionary crypt of type [String:String] which has values for all lowercase letters. The crypt dictionary represents a way to encode a message. For example, if crypt["h"]-"@" and crypt["" ..," the encoded version of the message "hi" will be "@l". Part 1: Write code that would take any string containing only lower case letters and spaces and encode it using the crypt dictionary (non-lower case letters can be encoded into themselves) Use the following crypt dictionary to test your code with the string message "hello swift var crypt = [ 1 2 Sample input: crypto swift Expected Output: -ye/.~!! Part 2: Write a function that takes a string and returns its encoded version using the crypt dictionary. Test your function with few sample strings including the sample input above Deliverables: Submit a copy of your code, (2) screen shot of at least two test cases showing your solution meets problem specs aboveStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started