Interactive Computer Systems Assignment 1 Fan Control

Task

Write a Java program that controls groups of fans. The interface should contain a specified number of fans and various control components.

Function Points

  1. A still fan. Use Java Graphics to draw a still fan with a circular frame and 3 or 4 arc-shaped blades. Hint: you can use drawOval to draw the frame and drawArc to draw the blades.
  2. A moving fan. Use three buttons to control the fan movement: on/off is to turn on/off the fan and reverse is to reverse its running direction. If the fan is off when reverse is pressed, the running direction will be reversed when the fan is turned on. Hint: you can use Timer to animate the fan movement.
  3. Speed control. Use a slider to control the fan’s running speed. If the fan is off when the speed is adjusted, the current speed will be used when the fan is turned on. Hint: you can use JSlider to achieve this.
  4. Speed smoothing. When the fan is turned on/off or its speed is adjusted, it will be smoothly accelerated/decelerated before it reaches the specified speed.
  5. Theme selection. Customise the fan’s colours including its background colour, the frame’s colour, and the blades’ colour and predefine some colour combination as themes. Design an interface for the user to select a theme.
  6. A group of fans. The user can specify the number of fans when the program starts and add new fans into or remove existing fans from the group when the program is running. Each fan in the group has its own controls and theme selection.
  7. Group control. The program allows the user to control all the fans as a group. For example, turn on/off all the fans, reverse them all, set the same speed or theme to all the fans. The group control overwrites the individual control.
  8. Separation of controls from fans. Bring all individual fans’ controls together, for example if the group has n fans, you will have n slides together, one for each fan with a proper label. The program interface would have 3 main areas: the fans (without controls), individual fans’ controls, and group controls. You need to carefully design a layout and sensibly choose interface components so that the user interface is easy to use and not cluttered.
  9. Multiple groups. The program allows the user to create multiple instances, one for each group of fans in a separated window. The state of each instance including the state of each fan can be saved and loaded later. Multiple instances can be loaded simultaneously. When an instance is to be closed, the user should be reminded to save its state.
  10. Manual and Look-and-Feel. The user can set the look-and-feel of each instance among a number of choices such as Metal, Nimbus, CDE/Motif, Mac OS X etc. The user can also access the manual describing how to use the fan control system. The manual should be properly formatted with sensible choices of fonts, colours, images and so on.

Style Points

  1. Appearance. The program presents an attractive appearance, including careful choice of colours and fonts, sensible choice and arrangement of components, and appropriate use of borders and other decoration.
  2. Geometry. The program window opens at a suitable size and maintains an appropriate layout of components when made (reasonably) larger or smaller.
  3. Code layout. Use indentation and white space to clearly display organisation and function. Apply layout rules universally and consistently.
  4. Code structure. Match control structures to the tasks they perform.  Declare variables only when necessary, and use appropriate scopes and types.
  5. Code documentation. Document all external interfaces according to accepted conventions. Use internal documentation where necessary and where it adds value to the code.