Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create an XCode project. Use the Single View App In your Main.storyboard Add a Using stack view, add 17 buttons: Numbers 0 through 9 (10

  1. Create an XCode project.
    • Use the Single View App
  2. In your Main.storyboard
    • Add a
    • Using stack view, add 17 buttons:
      • Numbers 0 through 9 (10 buttons)
      • Decimal point (.) (1 button)
      • Operations (+, -, *, /) (4 buttons)
      • Equality sign (=) (1 button)
      • All clear (AC) to clear the functions/contents in the label (1 button)
    • In your ViewController.swift file add appropriate outlets and actions to your above created objects.
    • All the buttons should have appropriate text and action. For example: Numbers should append appropriate number to the label, Equality sign should replace the label content with the result.
    • Your label must show the entire expression before the result is calculated (i.e. before the equality button is tapped.)

For example: With this sequence of button taps, 1, + and 2, your label must show "1", "1+" and "1+2" for each corresponding button tap. The label must be replaced with "3" when tapped on =.

  1. Change the background color of the label depending on the result
    • If the result is negative, change the background color of the label to
    • Since you will be converting the label string into an expression and perform the calculation, you will get errors for improper expressions. Handle that error, set the result in the label to 0 and change the background of the label to
    • For a calculated non-negative result, the background color of the label should be a default color (same color when the app is launched). The default is usually white, but you can choose any color other than black and
    • Make sure the text within the label is visible when the background color is changed (i.e. change the text color appropriately if the text is )

Note: When the result is 0, the background color can be different depending on the situation. If the result is 0 by calculation, the background color stays/turns to the same default color that you choose for a positive numbered result. The background color of label stays/changes to red only when the result is 0 by an error.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

AWS Certified Database Study Guide Specialty DBS-C01 Exam

Authors: Matheus Arrais, Rene Martinez Bravet, Leonardo Ciccone, Angie Nobre Cocharero, Erika Kurauchi, Hugo Rozestraten

1st Edition

1119778956, 978-1119778950

More Books

Students also viewed these Databases questions