CSC 471/371 Programming Assignment 3: A Simple Calculator solution

$24.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (5 votes)

Goals
• Explore Xcode and Swift language
• Explore Swift andiOS API documentation
o String class
o UIButton and UILabel classes
• Connect outlets and actions in Xcode
Assignments
1. Create a simple calculator app similar to the one shown below
o Use UIButton for the digits, ‘+’, and ‘=’ keys.
o Use a UILabel to display the result.
o You only need to handle integer additions in this assignment.
o The current number should be displayed after each digit key is pressed.
o After the ‘+’ key is pressed, the app waits for the next number to be added.
o The result, i.e., the sum, should be displayed after the ‘=’ key is pressed.
o Your app should properly handle key stroke sequences such as follows:
o 1 2 + 4 5 =
o 1 2 + 4 5 = + 6 7 =
2. Make sure your program
a. builds without errors or warnings, and
b. runs without crashing
Hints
The following are some of the methods and properties that might be useful in this
assignment.
• Use Int(str) to convert a string to an integer. (Note that the result type is an
optional type.)
Look them up in the API documentation for how to use these and other methods and
properties.
• UILable class reference
o text property
• UIButton class reference
o currentTitle property