Create array of elements and instantiate array with colors

Assignment Help Basic Computer Science
Reference no: EM133234666

A code in swift programming language

Create a constant and assign a color to it - the color should be a string.

Example: blue

Create an array of elements and instantiate the array with colors (strings) - 5 or more colors.

Example: (red, orange, blue, black, yellow, brown)

Use a loop to iterate through the array and check each color to see if it matches the color of your constant.

Print a message to the console

If a color matches the constant Print "Found a match at position X in the array" - X must be the actual position in the array.

If there are no matches in the array Print "No colors match"

(EXTRA) Account for multiple matches and indicate how many matches there are and at what positions in a single statement in the console

Example: Constant: red Array(red, green, red, orange, red, black, red, red)

Output: There were 5 color matches at positions 0,2,4,6,7 in the array.

Reference no: EM133234666

Questions Cloud

What is association learning : What is association learning? Which one is NOT correct? "Data Mining is about extracting information from data that is ...
Write script to simulate rolls : Write script to simulate rolls of 4-sided pyramid shaped die also called tetrahedron or D4 die one million times and make bar chart of it's values-frequencies
Administrators from university are among attendees : You are giving a presentation. Politicians, local business leaders, and administrators from your university are among the attendees
Build database named dbms course project : Build a Database named DBMS Course Project. I am to use Microsoft Access, Open Office, or such to draw the tables.
Create array of elements and instantiate array with colors : Create an array of elements and instantiate the array with colors (strings) - 5 or more colors.
Identify at least two different interactive products : Identify at least two different interactive products available in the market which are designed specifically to elderly for a similar purpose.
Predefined functions : Write a C program that changes a given program so that access is granted only if the user enters any password that would have previously been denied
Tridiagonal matrix is one where only nonzero elements : A tridiagonal matrix is one where the only nonzero elements are the ones on the main diagonal and the ones immediately above and below it.
Selectionsort or quicksort : Jason's assignment is to write either a SelectionSort or a Quicksort. She selects one of the two sorts and implements it correctly.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd