Leader board

An simple leader board application made by Java

 

This application is made based on an imaginary class setting, when students want to put their name and score in the program to compare with their classmates.

The windows are coded by JFrame, and the core mechanics including sorting, file writing and reading, and other basic function of JAVA.


LeaderBoard Input Screenshot.png

Input window

Feature 1

The first window let the user to input their name and score as a way to input the information.

how

  1. The program takes in the information and initiate a student object to store the information: name and score.
  2. Then the student will stored into an ArrayList.
  3. The sorting function sort the students array list according to their score, and count the rank order of the new student entry.

LeaderBoard LeaderBoard Screenshot5.png

After the user confirms the entry, the second window shows the leader board.

Feature 2

The top panel will always show the updated top-3 students according to the score.

The middle panel will show where the entry student is at with 2 students ahead and 2 students after.

The button at the bottom panel let user return the first panel and make more entry.

How

  1. Used BorderLayout to construct the window with JPanel because it’s flexible.
  2. Get necessary student objects from students ArrayList from window1 and add to new Arrays made for the top panel and for the middle panel.
  3. In the middle panel, change the block color according to the rank order, which is calculated in Window1.

Feature 3

In some special cases, the new entry doesn’t have 2 students ahead or 2 students behind. I wrote the algorithm to accommodate these occasions.