CS 178 Programming with Multimedia Objects Array

Array Example: Applets Developed Incrementally

For use during Lectur es on October 4 and 6 , 2004

The problem:

Write an applet that allows

  1. entry and display of names and atomic weights of chemical elements into an in-memory database,
  2. selection of any element in the database to know its atomic weight, and
  3. arranging the display of the names of chemical elements in the increasing order of their atomic weights.

We will develop the applet incrementally. In step 1, we solve the problem of data entry and display of names entered. In the second step we solve the problem of display of the atomic weight of any selected element that is in the database. Finally, in step 3, we solve the problem of arranging the display of element names in the choice list according to their atomic weights.

What will you learn (in addition to what you already know about applets):

  • What is an in-memory database.
  • Data representation and access using arrays. [Chapter 8.2, pages 342-344]
  • Searching for data in an array. [Chapter 8.2, pages 345-348]
  • Sorting an array. [Chapter 8.3, pages 354-355]
  • Divide and conquer and incremental development.

Data entry Applet. No searching and sorting. Problem 1 solved.


Data entry applet with searching. No sorting. Problems 1and 2 solved incrementally.


Data entry applet with searching and sorting. Problems 1, 2, and 3 solved incrementally.

Prepared by: Aditya Mathur, Oct 4, 2004