Course resources for the Introduction to Computer Science I by James Tam Return to the course web page

CPSC 231: Bonus assignment

New Concepts

Graphical user interfaces (GUIs)

Introduction

For this bonus assignment you must create a graphical user interface for your solution of either assignment 1, 2 or 4. (You may also create a GUI for assignment 5, but note that this will be a very challenging GUI to create).

For assignment 1, 2 and 4 you asked the user for various data, did some computation with the data and then displayed the result of the computation. In these three assignments, all the interaction with the user was done via a text based console. Most applications that are developed today use a graphical user interface, which is more user friendly than a text-based interface.

Requirements

Rewrite your solution for assignment 1, 2 or 4 such that your solution uses a GUI rather than a text-based interface. Your GUI should make it clear which data is required and limit options as much as possible to valid options. The data should also be presented in a format that is easy to use. For example, if the user is asked to enter a month, they should be presented with a list of valid months: January, February, etc.

To get full marks for this assignment, your code should be an object-oriented solution and all (or most) of the code should be inside a class. Each class should be coherent. The attributes and methods in a class definition should make sense (one would likely give class 'Fish' a 'swim()' method, a 'fly()' method would not make sense as part of class 'Person'). Variables that are not attributes of a class (e.g., a loop control) can be made as local variables. Operations of the program that don't logically belong to a class can be implemented as regular functions rather than as methods.

As usual, your code should follow standard coding practices, be easy to read and well documented.