Assignment 2_0

Assignment 2_0 - CS193P IPHONE APPLICATION DEVELOPMENT...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Assignment II: More Calculator Objective The goal of this assignment is to extend the CalculatorBrain from last week to allow inputting variables into the expression the user is typing into the calculator. This involves using foundation classes, properties, a few class methods, and Fguring out memory management: all things talked about in class this week. You will not be “walked through” this assignment line by line, but there will be some signiFcant guidance as to how to accomplish the goal. Starting with this assignment, you will be evaluated on whether your code leaks memory, so be sure to understand the memory management ramiFcations of all of your code. We don’t expect perfection on this front at this point, but ignore it at your peril because it gets more challenging as the weeks go by. Next week’s assignment will build on this week’s so don’t fall behind! This assignment must be submitted using the submit script (see the class website for details) by 11:59pm on Tuesday, April 13th. You may submit it multiple times if you wish. Only the last submission will be counted. If you had trouble getting the submission script to work last week and were allowed to submit by e-mail by your TA, make sure you’ve Fgured it out early in this week because there will be no submitting by e-mail this week. Be sure to check out the Hints section below! Also, check out the latest additions to the Evaluation section to make sure you understand what you are going to be evaluated on with this (and future) assignments. Materials • If you successfully accomplished last week’s assignment, then you have all the materials you need for this weeks. It is recommended that you make a copy of last week’s assignment before you start modifying it for this week’s. CS193P IPHONE APPLICATION DEVELOPMENT SPRING 2010 PAGE 1 OF 14 ASSIGNMENT I1: MORE CALCULATOR
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Required Tasks 1. Implement the following API for your CalculatorBrain as described in the following sections. @interface CalculatorBrain : NSObject { double operand ; NSString * waitingOperation ; double waitingOperand ; id expression ; } - ( void )setOperand:( double )aDouble; - ( void )setVariableAsOperand:( NSString *)variableName; - ( double )performOperation:( NSString *)operation; @property ( readonly ) id expression; - ( double )evaluateExpression:( id )anExpression usingVariableValues:( NSDictionary *)variables; + ( NSSet *)variablesInExpression:( id )anExpression; + ( NSString *)descriptionOfExpression:( id )anExpression; + ( id )propertyListForExpression:( id )anExpression; + ( id )expressionForPropertyList:( id )propertyList; @end 2. Modify your CalculatorViewController to add a target/action method which calls setVariableAsOperand: above with the title of the button as the argument. Add at least 3 different variable buttons (e.g. “x”, “a” and “b”) in Interface Builder
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/15/2011 for the course CS 193P taught by Professor Evandoll during the Spring '09 term at Stanford.

Page1 / 14

Assignment 2_0 - CS193P IPHONE APPLICATION DEVELOPMENT...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online