Home > 2010 Fall DPS913 > DPS913 APD601 Lab 2 (due Mon Oct 4)

DPS913 APD601 Lab 2 (due Mon Oct 4)

September 23, 2010 Leave a comment Go to comments

Lab 2 enables you to work more with user interface objects and type conversions. You also work with a picker, and its backing store, an array. You will create a “bus ticket sale” app. It is due on Monday October 4.


DPS913 APD601 Lab 2 – due Mon Oct 4

Assigned: During Week 3

Due date: Monday, October 4, 2010, at 11:40am

Grade value: 3% of your final course grade

Grading method: The following will be checked:

  • Completeness and adherence to iOS app coding principles
  • Correct interactive operation of the app’s logic
  • Accurate numerical calculations


Before you begin

Configure your Xcode environment as described in the “Before you begin” section of Lab 1. This will ensure that your work can be uploaded for grading.



Create an iOS app that enables you to work with arrays, and a UIPickerView, which is a user interface object that requires a data source and delegate.

The app is an iPhone OS version of the bus route ticketing app that you created in your ASP.NET course.


Concepts that you will learn

This is a challenging assignment for the beginning iOS programmer. You will learn how to apply concepts that we’ve discussed so far, and you will learn new ones. Here’s just a sample:

  • Object creation
  • Declared properties
  • Application life cycle (awakeFromNib, viewDidLoad, etc.)
  • Arrays – mutable and immutable
  • Type conversion
  • Using a delegate
  • Modularizing your code by creating methods and so on


Introduction to the problem that you will solve

The Red Dog Bus Company needs a new point-of-purchase bus trip ticketing application for its customers. The company currently has four bus routes that start in Toronto, and make round trips to Barrie, Peterborough, Ottawa, and Sault Ste. Marie.

Each bus has 36 seats. Therefore, when the application starts, all routes will have 36 available seats. The application enables the customer to:

  1. Select a bus route
  2. Select the number of seats/tickets
  3. “Buy” the tickets.

When the purchase is completed, the number of available seats on that route will be updated to the new amount.

This application will NOT connect to a central server, and will NOT implement actual payment processing. Also, you do NOT have to store/persist any data in this Lab 2.



Bus ticket sale example appCreate a new iOS project, using the View-based Application template, and name it “BusTickets“. Make sure its layout is similar to the example at the right (however, some of the captions and other identifiers may be different).

Use a segmented control, with four segments. Label the segments with text that will fit; we suggest BAR, PTR, OTT, and SSM.

Use a picker view to hold the number of available seats on the bus route that’s currently selected. The picker’s selected row will directly map to the number of tickets required (i.e. to be purchased). When the application launches, 36 tickets will be available for each bus route. The picker’s visible text must include number of tickets x ticket price = total cost, as shown in the example to the right.

The ticket price for each bus route is as follows:

  • Toronto to Barrie ($28.80 per ticket)
  • Toronto to Peterborough ($39.35 per ticket)
  • Toronto to Ottawa ($109.30 per ticket)
  • Toronto to Sault Ste. Marie = ($156.80 per ticket)

The application should allow the user to make a ticket purchase by following these steps:

  1. Select the route by taping the segmented control
  2. Select the number of tickets required by swiping the picker
  3. Complete the purchase by tapping the “Buy” button

When the user taps the segmented control, the values in the picker will be regenerated and displayed.

When the user taps the “Buy” button, the number of available seats for the selected bus route will be reduced by the number of tickets purchased. Also, it will display, below the button in another status label, a completion message (showing tickets bought x ticket price = total cost).

For detailed guidance on how to complete this lab, read the “Lab 2 guidance” post.


Send me your work

Make sure that you have configured your Xcode environment to avoid sending the intermediate build files. This will ensure that your uploads to me are the right size.

Follow these instructions to send me your work:

  1. Make sure your project works correctly
  2. Locate your BusTickets project folder in Finder
  3. Right-click the folder, and choose Compress “BusTickets”, which creates a zip file
  4. Visit this page: http://matrix.senecac.on.ca/~peter.mcintyre/dps913/, and upload BusTickets

Categories: 2010 Fall DPS913
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: