Code Monkey home page Code Monkey logo

objc-deli-001-prework-ios's Introduction

Deli Counter

Objectives

  1. Write custom methods that take arguments and return results.
  2. Use a method as a helper method.
  3. Read and run unit tests to check your work.

Instructions

The local deli is putting in a new computerized queue to keep track of their customers and improve productivity.

  1. Open the *.xcworkspace file. Declare three instance methods (beginning with -) in FISAppDelegate.h:
  • stringWithDeliLine: should accept an NSArray argument deliLine and return an NSString object.
  • addName:toDeliLine: should accept an NSString called name and an NSMutableArray called deliLine as arguments, and return nothing.
  • serveNextCustomerInDeliLine: should accept an NSMutableArray called deliLine as an argument and return an NSString.
  1. Define them in FISAppDelegate.m to return a default value (or nil) and run the tests to fail. Review what the Spec file expects from your methods.

  2. Build the stringWithDeliLine: method to:

  • if there are no customers in line, return the string The line is currently empty.,
  • otherwise, return a formatted string beginning with The line is: and appending every customer in the queue on a new line (\n) beginning with their number in the queue, e. g. 1. Anita. Remember, these customers are humans so they count from one—not from zero like computers.
  1. Build the method addName:toDeliLine: method to add the submitted name to the deliLine. Since the deliLine argument is mutable, this method does not need to return an array; the array argument is modified in-place.

  2. Build the method serveNextCustomerInDeliLine: method. Save the first name in the deliLine to an NSString object within the method. Then remove the first object from the deliLine and return the name you removed. Hint: Using removeObject: could be problematic for you. There's another method on NSMutableArray that will let you specify an object to remove by array index.

objc-deli-001-prework-ios's People

Contributors

markedwardmurray avatar altyus avatar zdrossman avatar fs-lms-test-bot avatar jimcampagno avatar misterfifths avatar chrisgonzgonz avatar jmburges avatar sarogers avatar fislabstest avatar yuchiz avatar

Watchers

James Cloos avatar  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.