Giter Site home page Giter Site logo

fizzbuzz's Introduction

FizzBuzz

The sixth project for iOS pre-course using loops

Resources:

  • We're about to finish off (read section 4) "Control Structures, Loops and Collections" intro to loops an d - Loops are pretty simple, and this article will give you a good overview.
  • For Objective-C read RyPress.com's C Basics. Jump down to the section on Loops.
  • For Swift read Apple's documentation on For Loops

Step 1: Get the project started on your computer and on GitHub

  • Either create a project locally and push to GitHub
  • Or fork this project and clone it to your computer

Note:

  • For more detailed instructions of 'Step 1' see the first project
  • 'Step 1' is something we will do hundreds of times in class. You need to be able to do it quickly and without running into issues so it doesn't slow class down.

Step 2: Create a buzz check method

  • Add a method called isBuzzed that takes an integer and returns a bool
  • The method should check to see if the integer is a multiple of 3
  • If the number is a multiple of 3 it should return true
  • If the number is not a multiple of 3 the method should check to see if the number contains the character 3
  • If the number contains the character three it should return true
  • Otherwise it should return false

Step 3: Create a fizz check method

  • Add a method called isFizzed that takes an integer and returns a bool
  • The method should check to see if the integer is a multiple of 5
  • If the number is a multiple of 5 it should return true
  • If the number is not a multiple of 5 the method should check to see if the number contains the character 5
  • If the number contains the character three it should return true
  • Otherwise it should return false

Step 4: Call FizzBuzz methods

  • In your didFinishLaunching method loop through numbers 1-100
  • For each integer call isBuzzed and isFizzed
  • If the integer isBuzzed but not isFizzed print "Buzz"
  • If the integer isFizzed but not isBuzzed print "Fizz"
  • If the integer isFizzed and isBuzzed print "FizzBuzz"
  • If the integer is not isFizzed and is not isBuzzed print the number

Completion

  • You should have printed numbers 1-100.
  • You shouldn't see any 3s or 5s in the list anywhere.
  • You could start by looking at 6, 9, 12 and see if they are buzzed
  • You could look at 5, 10, 25, 95 and see if they are fizzed
  • You could look at 15, 51, 90 and see if they are fizzbuzzed

fizzbuzz's People

Contributors

jkhowland avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.