Assignment 2 - STANFORD CS193P IOS 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: Programmable Calculator Objective The goal of this assignment is to extend the CalculatorBrain from last lecture’s demo to allow inputting variables into the calculator’s program and to show the user the steps they have entered to get the result showing in the display (i.e. showing the CalculatorBrain ’s “ program ”). This involves using the id type, introspection, Foundation classes, enumeration, and understanding properties: all things talked about in class this week. You will not be “walked through” this assignment line by line. 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 the end of the day next Wednesday. You may submit it multiple times if you wish. Only the last submission will be counted. 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 • You should begin by taking your assignment from last week and adding the interface and implementation of the CalculatorBrain API demonstrated in the last lecture ( program property, descriptionOfProgram: and runProgram: ). This code is downloadable from the class website, but it does not include the additions you were required to make to last week’s walkthrough, so you’ll have to merge them in yourself. • It is recommended that you make a copy of last week’s assignment before you start modifying it for this week’s. STANFORD CS193P IOS APPLICATION DEVELOPMENT FALL 2011 PAGE 1 OF 9 ASSIGNMENT I1: PROGRAMMABLE CALCULATOR
Image of page 1

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

View Full Document Right Arrow Icon
Required Tasks Your solution to this assignment must include properly functioning implementations for the three public methods added to the CalculatorBrain in lecture. You may change the internal implementations as necessary (though you almost certainly do not want to change the implementation for the @property ), but do not change the public API for these (including whether a method is a class method or not): @property ( readonly ) id program; + ( double )runProgram:( id )program; + ( NSString *)descriptionOfProgram:( id )program; Also, do not break any existing CalculatorBrain functionality with your new features in this assignment. 1. Add the capability to your CalculatorBrain to accept variables as operands (in addition to still accepting double s as operands). You will need new public API in your CalculatorBrain to support this. A variable will be specified as an NSString object. To simplify your implementation, you can ignore attempts to push a variable whose name is the same as an operation (e.g. you can ignore an attempt to push a variable named “ sqrt ”).
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