Question
SWIFT 5.7 (I am using PlayGrounds to run my Code) Collection Types Read up section on Arrays. This homework exercise will be to generate an
SWIFT 5.7 (I am using PlayGrounds to run my Code) Collection Types Read up section on Arrays. This homework exercise will be to generate an array, append items to an array, insert items to an array, and iterating items in an array to print items. The iBooks doesnt support page numbers on the book as typical printed book would. If you resize you iBooks window, contents will be adjusted to fit the page and that will lead to different page numbers for different sizing. 1. The programming exercise for this week is to declare mutable array. Please review subsection Creating an Array with an Array Literal and follow example provided in this subsection. You will generate an Array with initial list of your three favorite cars. 2. Next add a new item to the end of array you created in earlier step. For name, you can pick another car name. 3. Now add three names at locations 6, 7 and 8. You can follow discussion on Accessing and Modifying an Array. Pick three other car make names that you like. Next set of code exercise is to iterate over an array. You can iterate using various control structures (for, while etc.) 1. Print entire array using for structure. There is an example in Iterating Over an Array. 2. Now Modify entries in your array. Modify 4th entry with Starfire. 3. Print entire array again to verify that entry is modified Question for you to think about (can be multiple choice question in exam). These questions are not for homework but self study to gain deeper understanding of the topic. 1. How would you build an array that will hold constant value i.e. value of the elements cannot be changed. 2. We have not learned string functions in depth but you can scan ahead and learn how to check for name of value (say car make in our case) for names that start with A or a. Write code to do so and print members of array that start with A or a.
Step 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