Assignment #1 Task #1

Please note, this blog entry is from a previous course. You might want to check out the current one.

The first assignment is an extension of the calculator built in lecture #2.

Follow the walk-through instructions (separate document) to build and run the calculator in the iPhone Simulator. Do not proceed to the next steps unless your calculator functions as expected and builds without warnings or errors.

Basically this is solved by code at the end of lecture #2. However, limited time during the lecture prevented the instructor from finishing everything, thus we have to add subtraction and division as operands to CalculatorBrain.m:

    } else if ([@"-" isEqualToString:operation]) {
        double subtrahend = [self popOperand];
        result = [self popOperand] - subtrahend;
    } else if ([@"/" isEqualToString:operation]) {
        double divisor = [self popOperand];
        result = [self popOperand] / divisor;
    }
FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

Leave a Reply

Your email address will not be published.