{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Assignment 2_0 - CS193P IPHONE APPLICATION DEVELOPMENT...

Info icon This 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 figuring 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 significant 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 ramifications 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 figured 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
Image of page 1

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

View Full Document Right 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 and hook them up to this method.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern