cover picture cover picture


Midterm Exam

CMP 430: iOS Mobile Programming
Lehman College, City University of New York
Fall 2018


Objective

In this exam, you will create a slot machine game. Your slot machine will have three views each with a circle in it.

Required Tasks (100 points)

  1. Your game will have the following:
    • Three Views.
    • A Spin button.
    • A Reset button.
    • A Score label.

  2. You will need to have a CircleView class which extends the UIView class. This class represents each View and should be able to draw a circle according to it's properties:
    • Each cicle can have one of the following colors:
      • Red
      • Blue
      • Green
      • Purple

    • Each cicle can have one of the following shades:
      • Outlined
      • Striped
      • Filled

  3. Your model will have a Game class that manages the spinning and the score. In addition, your model should have a Circle that represents a circle, it's color and shade.

  4. The Game should:
    • Manage the changing of the circles.
    • Manage the score as follows:
      • A new game starts with a score of 100.
      • Each spin costs the player 10 points.
      • All circles are the same color and the same shade, the user earns 300 points.
      • All circles are the same color and all different shades, the user earns 250 points.
      • All circles are the same colors (shades are neither same nor all different) the user earns 200 points.
      • All circles are different colors and all the same shade, the user earns 150 points.
      • All circles are different colors and all different shades, the user earns 100 points.
      • All circles are the same shade (colors are neither all the same nor all different) the user earns 50 points.
    • When the user has a score less than 10, the Spin button should be disabled.

  5. Pressing the Spin button should cause all the circles to change to random colors and random shaing.

  6. Pressing the Reset button should cause the game to reset the score to 100.

  7. Make sure that your circle is drawn in proportion to the size of your CircleView.

  8. You should use Auto Layout so your game can be used in both Portrait as well as Landscape mode.

Hints

  1. Your Game should have the following methods:
    • spin()
    • reset()

  2. Your Game should have the following attibutes:
    • An array of Circle objects
    • score

  3. Your Circle should have the following method:
    • randomizeColorAndShade()

  4. Your Circle should have the following attributes:
    • color
    • shade

  5. Use stacks to layout your user interface and specify all the constraints so that your app works on all devices in both portrait and landscape mode.

Please submit the completed midterm exam on Blackboard as a zip file of your entire project. No other forms of submission will be accepted.