Assignment #3 Task #3

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

Add a Graph button to your calculator’s user-interface that, when pressed, segues to a new MVC (that you will have to write) by pushing it onto the UINavigationController’s stack (on the iPhone). The new MVC graphs whatever program was in the calculator when the button was pressed. To draw the graph you will iterate over all the pixels in your view horizontally (x) and use +runProgram:usingVariableValues: to get the corresponding vertical (y) value. You will, of course, have to convert to/from your view’s coordinate system from/to a reasonable graph coordinate system. You will need a scale and origin to do this coordinate system conversion. If the user has not already chosen a scale and origin for the graph (see Required Tasks 7 & 8 below), pick a reasonable starting scale and origin.

… and still inside your storyboard, drag out a new view controller, place a new button called “Graph” into your calculator view controller and create a push segue from your new button to your new view controller.
Continue reading “Assignment #3 Task #3”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

Assignment #3 Task #2

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

The only variable button your calculator’s user-interface should present is x (so remove any others you added in Assignment 2 and you can remove your Test buttons and the UILabel which shows the value of the variables being used in the display).

Again inside your story board, delete the variable & test buttons as well as the label for the used variables. You might also want to rearrange the remaining buttons.

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

Assignment #3 Taks #1

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

The third assignment is yet a further extension of the calculator built in the previous assignments.

When your application is run on the iPhone, it must present the user-interface of your calculator from Assignment 2 inside a UINavigationController.

Just go to your storyboard, select the existing CalculatorViewController and embed it into a new UINavigationController clicking Editor -> Embed in -> Navigation Controller. Then double click the newly created navigation bar inside the CalculatorViewController and name it “Calculator”.

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

Assignment #2 Extra Task #1

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

Enhance your application to show the user error conditions like divide by zero, square root of a negative number, and insufficient operands. One way to do this (and to get more experience with using id) might be to have runProgram:usingVariableValues: in CalculatorBrain return an id (instead of a double) which is an NSNumber with the result or an NSString with the description of an error if it encounters one. Then update your Controller to use introspection on the return value and display the appropriate thing to the end-user.

Mainly the API of the CalculatorBrain has to be changed from double to id:
Continue reading “Assignment #2 Extra Task #1”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail