# Assigment

Páginas: 9 (2020 palabras) Publicado: 7 de junio de 2011
CS193P IPHONE APPLICATION DEVELOPMENT

FALL 2010

Assignment I: Calculator
Objective
This assignment has two parts. The goal of the ﬁrst part of the assignment is to recreate the demonstration given in the second lecture. Not to worry, you will be given very detailed walk-through instructions in a separate document. It is important, however, that you understand what you are doing witheach step of that walk-through because the second part of the assignment (this document) is to add a few extensions to your calculator which will require similar steps to those taken in the walk-through. 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 lastsubmission will be counted. For example, it might be a good idea to go ahead and submit it after you have done the walk-through and gotten that part working. Be sure to check out the Hints section below!

Materials
• By this point, you should have been sent an invitation to your Stanford e-mail to join the iPhone University Developer Program. You must accept this invitation and download the iPhoneSDK. It is critical that you get the SDK downloaded and functioning as early as possible in the week so that if you have problems you will have a chance to talk to the TA’s and get help. If you wait until the weekend (or later!) and you cannot get the SDK downloaded and installed, it is unlikely you’ll ﬁnish this assignment on time. • The walkthrough document for the ﬁrst part of the assignmentcan be found on the class website (in the same place you found this document).

PAGE 1 OF 7

ASSIGNMENT 1: CALCULATOR

CS193P IPHONE APPLICATION DEVELOPMENT

FALL 2010

1. 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 builds withoutwarnings or errors and functions as expected. 2. Your calculator already works with ﬂoating point numbers (e.g. if you press 3 / 4 = it will properly show the resulting value of 0.75), however, there is no way for the user to enter a ﬂoating point number. Remedy this. Allow only legal ﬂoating point numbers to be entered (e.g. “192.168.0.1” is not a legal ﬂoating point number). 3. Add the following foursingle-operand operators: • 1/x : inverts the number in the display (i.e. 4 becomes .25). Be sure to handle the case where the display currently contains a zero. You can fail silently, but don’t crash. • +/-: changes the sign of the number in the display. • sin : calculates the sine of the number in the display. • cos : calculates the cosine of the number in the display. 4. Add the followingthree “memory” buttons: • Store : stores the current value of the display into a memory location. This button should not change the number that is in the display. • Recall : recalls the value in memory. • Mem + : adds the current value of the display to whatever’s already in memory. This button should not change the number that is in the display. 5. Add a “C” button that clears everything (thedisplay, any “waiting” operations, and the memory). 6. Avoiding the problems listed in the Evaluation section below is part of the required tasks of every assignment. This list grows as the quarter progresses, so be sure to check it again with each assignment.

PAGE 2 OF 7

ASSIGNMENT 1: CALCULATOR

CS193P IPHONE APPLICATION DEVELOPMENT

FALL 2010

Hints
These hints are notrequired tasks. They are completely optional. Following them may make the assignment a little easier (no guarantees though!). 1. Be careful when copying and pasting buttons in Interface Builder because the target/ action of the button will be copied as well. • Sometimes this is what you want (e.g. if you’re creating some more operation buttons from an existing operation button). • Sometimes it is not...

Regístrate para leer el documento completo.