Assignment 2


Info iconThis 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
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 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 speciFed 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 ”). The values
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 01/25/2012 for the course CS 193P taught by Professor Evandoll during the Fall '09 term at Stanford.

Page1 / 9


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