Programming in Java Practical Class

Programming in Java


Table of Contents

Course schedule
Bonus exercise

This course consists of a series of practical classes designed to teach the basics of programming in Java. There are no lectures associated with this course, but there is a question based on it in the final exam. The material in this couse relies on the material taught concurrently in Object-Oriented Programming.

In contrast to the practical assessment associated with Foundations of Computer Science last term, this course requires you to attend a two hour practical lesson once a week for the eight weeks in Lent Term. During the practical lessons you will work through course workbooks. You will also need to complete the associated assessed exercise, or tick, described at the end of each workbook.

The tasks you need to perform in week n of the practical class are as follows:

  1. Arrive at the practical class at the start of your allocated time period (1400-1600, or 1600-1800).

  2. Find your computer as allocated on the seating plan (available on the course website or ask a demonstrator at the start of your session).

  3. When the ticker comes to your desk, be prepared to discuss the practical work you completed for week n-1.

  4. Leave your computer at the end of the session, taking your workbook(s) with you; you may continue to complete any exercises in your own time.

  5. Ensure your solution to the exercises for week n is correct (including any automated tests) and print it out ready for marking in week n+1.

Note: when n=1 (i.e. the first week), the ticker will mark your submission for ML tick 6 and when n=8 there is no additional work but the ticker will mark your submission for Java tick 7.

Those students who are offering only Paper 1 of the Computer Science Tripos need only complete the first five ticked exercises but are free (and encouraged) to attempt all seven. The starred exercises are optional to all students.

Course schedule

Week 1: 17th January

Using PWF Linux: How to restart a PWF machine into Linux

Week 1: 17th January

Workbook 1: Java command-line tools; primitive types and operators

Week 1: 17th January

Workbook 1*: Bnary representation of floating point numbers

Week 2: 24th January

Workbook 2: Conditional execution and loops

Week 2: 24th January

Workbook 2*: More loops

Week 3: 31st January

Workbook 3: Arrays and references

Week 3: 31st January

Workbook 3*: Animated graphics

Week 4: 7th February

Workbook 4: Exceptions; reading data from external sources

Week 4: 7th February

Workbook 4*: Batch analysis and statistics

Week 5: 14th February

Workbook 5: Interfaces and inheritance

Week 5: 14th February

Workbook 5*: Audio synthesis

Week 6: 21st February

Workbook 6: Building a Graphical User Interface (GUI)

Week 6: 21st February

Workbook 6*: Drawing graphs

Week 7: 28th February

Workbook 7: Handling GUI events

Week 7: 28th February

Workbook 7*: More GUI programming

Week 8: 7th March

Final practical class and ticking session of term

Easter Term: 25th April

Last ticking session for any remaining unmarked work

Bonus exercise

Android smartphones are primarily programmed in Java. Its surprisingly easy to build your own Android applications. This year we have an extra bonus exercise to help you get started with Android programming. Completing this exercise does not provide any additional course credit, but please do tell the course lecturers when you have completed it: they are keen to hear how you have got on.

If you already have an Android handset you can develop your application on that. Alternatively, we have 12 Android smartphone handsets to loan to students this term and over the Easter vacation. If you would like to borrow a phone you should send an email to ticks1a-admin@cl.cam.ac.uk once you have passed the unit tests for the first five ticks and associated starred exercises. Phones will be allocated by lottery drawn at 14:00 on the day of the 6th practical session.

The task is to build a GeoMessaging application in order to demonstrate your basic understanding of programming a simple Android application. A GeoMessage consists of a photograph, a short piece of text and a location. The application should consist of an Activity for posting a GeoMessage. The Activity should allow the user to take a photograph and enter some text. When the user indicates that they are ready, the message and the current location should be uploaded to the central server provided by the Programming in Java lecturers. Figure 1, “Screenshots of the Android application” provides a visual impression of the application requirements.

Screenshots of the Android application

Figure 1. Screenshots of the Android application


An (optional) extension to this Bonus exercise is to extend the application with an Android Service which runs in the background monitoring the device's current location. When a location update is received you should consult the central server; if there are any new messages near this location you should create a Notification for the user so they can read the nearby GeoMessage. If the notification is selected by the user, your application should display the new message in a new Activity.

A getting-started guide and a detailed walk-through is available on the course website.

Copyright 2008-2012 Alastair R. Beresford and Andrew C. Rice