DPS913 APD601 Lab 2 (due Wed Feb 10)

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 Wednesday February 10.

.

DPS913 APD601 Lab 2 – due Wed Feb 10

Assigned: During Week 3 (a bit late – oops)

Due date: Wednesday, February 10, 2010, at 9:50am

Grade value: 3% of your final course grade

Grading method: The following will be checked:

Completeness and adherence to iPhone OS 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.

.

Objective(s)

Create an iPhone OS 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 iPhone 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, London, Montreal, and Sault Ste. Marie.

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

Select a bus route

Select the number of seats/tickets

“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.

.

Specifications

Create a new iPhone Application project, using the View-based Application template, and name it “BusTickets“. Make sure it looks similar to the example at the right.

Use a segmented control, with four segments. Label the segments with text that will fit; we suggest BAR, LON, MTL, 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, 38 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 ($29.80 per ticket)

Toronto to London ($41.35 per ticket)

Toronto to Montreal ($106.40 per ticket)

Toronto to Sault Ste. Marie = ($150.70 per ticket)

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

Select the route by taping the segmented control

Select the number of tickets required by swiping the picker

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).