Paul's Projects Place - Java Projects


In this section are links to all the programs that I wrote using the high level programming language of Java and a program using JavaCC. The first selection comprises of code which I wrote and compiled within the first year of study at university and the last remaining program being created in the second year.


How to install JDK runtime and run java programs in the command line.

Step 0: Test if java is installed

Alternatively, open a command prompt window (press Win⊞ + R, type cmd, and hit Enter) and enter the command: java -version. This will output the version of Java installed on your computer. If the command is not recognized then you will need to install tg Java SDK

Step 1: Install Java SDK

Step 2: Find path to your Java installation folder which can be found through

Environment variables for java installation

File Explorer or Command Prompt. This will usually be C:\Program Files\Java\

Step 3 Right Click on MyComputer and click on properties .

Step 4: Click on Advanced tab

Step 5: Click on Environment Variables

Step 6: Create a new class path for JAVA_HOME

Step 7: Enter the Variable name as JAVA_HOME and the value to your jdk bin path ie c:\Programfiles\Java\jdk-1.6\bin and

NOTE Make sure u start with .; in the Value so that it doesn't corrupt the other environment variables which is already set.

Step 8 : Follow the Above step and edit the Path in System Variables add the following ;c:\Programfiles\Java\jdk-1.6\bin in the value column.

Step 9 :Your are done setting up your environment variables for your Java , In order to test it go to command prompt and type


who will get a list of help doc

In order make sure whether compiler is setup Type in cmd


who will get a list related to javac

To run a program type

go to the directory where the program is installed:


Then type in:


How to compile & run a Java application


Cookie Recipe Ingrediants Calculator

This program calculates the amount of ingredients required to make a define number of cookies.

Investment Calculator

This program was created as simple way to calculate interest on a given amount of money. To test my skill and development of variable names, use of operators and expressions.

Mileage Program

This program displays the efficiency of the vehicle in kilometres of the vehicle in kilometres per gallon to an accuracy of 2.d.p. The distance travelled per litre of petrol to the nearest meter and the cost of driving 100 kilometres using the computers current locale to display the correct currency.

Screenshot of the calulation results for the car program

Guess the Magic Number

The aim of this program is for the user to guess the number between 1 and 10 that the computer has randomly generted. The computer generates the number, then allows the user to guess three times. After each turn the computer informs the user if the guess is too high or too low. The user wins if they guess the correct number. At the end of the game the program will ask if the user would like to replay the game.

Cartesian Transformation Calculator

This program is able to calculate new sets of coordinates on a Cartesian grid when some type of transformations is used upon them. It also reinforces understanding in the implementation of classes, methods, object and instance variables.

Pontoon Program

This program runs a version of pontoon or black jack using the command-line function in Java. The aim of the game is to gain a higher sum then the bank but without being higher then the value of 21. The bank deals a hand of two cards, the player then inspects these cards and then chooses whether to stick or twist in which case the player receives another card. This continues until the player decides to stick achieves a five card trick or goes bust. The bank then deals itself a card until it has a value greater than or equal to that of the players or goes bust in which case the player wins.

SVGDraw Program

This program imitates a selection of different images using JavaCC and SVGDraw.



Example Output


Example Output
Circle and Square Rectangle and Ellipse Polygon and Triangle Circle and Square Rectangle and Ellipse Polygon and Triangle


Example Output
Circle and Square Rectangle and Ellipse Polygon and Triangle Circle and Square Rectangle and Ellipse Polygon and Triangle


Example Output
Circle and Square Polygon and Triangle Repeat Circle and Square Polygon and Triangle Repeat


Example Output
Juggle Juggle


Example Output
Juggle in Colour Juggle in Colour

Correlation Calculation Program

This program takes a dataset and calculates the Variance of X and Y, Covariance and Correlation.

Collapsing Puzzle Game

Welcome to Collapsing Puzzle Game, this a game of levels where the player aims to clear all the blocks in the grid, or to run out lines set to be injected into the grid.

The game area is split into three disticnt sections the menu with large buttons to manage the game. In the middle section is a 12 * 16 playing grid with each block in large blocks that allows the user to click on any block in play that can be removed. At the bottom in large text is the area that displays the players vital statistics.

Random Filling

When a new level begins the bottom row will start auto-populating the grid with new blocks from left to right, these blocks are not interactable until the row has been fully populated.

random filling

Then all of the blocks in the whole grid move up the grid by one row, the bottom row will become empty and will populate from the left again repeating the process.

If any block occupy the top line of the grid the player looses and the game ends. If the player completes or fails the game their score will be checked with the previous high scores to check if they are within the top 10 highest scores of previous player playing the game.

New rows of blocks will be added to the grid until the number of lines listed in the vital statistics reaches 0. On reaching 0 the player wins the level and the next level begins automatically. Alternatively the player can clear all of the blocks in the player area and move to the next levl. If the player completes level 10 they win the game completely.

Whether you win or lose when the total final score is more than that stored in the top ten highscores then the player is give the option to save there name against the score.


Removal of Clusters

In thi sexample, here is a rather large cluster, it expands out in all directions. On clicking on any block within th ecluster will spontaneously disappears and increases to players score for being able to destroy them. The larger the cluster is when destroyed the larger the bonuses will be. Therefore a player using his knowledge of the game can try to engineer scenarios to maximise their bonus points.

cluster removal


In this demonstration when the cluster is clicked on at the bottom of grid the cluster disappears and is destroyed, this then leaves a void from which the blocks above are seen to fill the gap as they are attracted to the bottom of the panel. The orange arrows represent the movement of blocks within the grid.



Here the cluster of red blocks are removed, as there are no blocks to fall down into the empty slot and because there empty space has items to the right - attraction takes affect moving the blocks closer to the centre. The orange arrows represent the movement of blocks within the grid.


Display Points and Bonuses

Bonuses are asserted when one of two
things happens. If the player destroys a large cluster of blocks or if the level is completed and then every row that is empty will give the player 50 bonus points.


Special Bombs and Colour Bombs

In the grid if you get any super bomb and click on it the subsequent response the computer will give will remove anything else with the same colour e.g. the other super bombs of its colour and any standard blocks situated in the grid as well for this no sore will be added to the user but is a good way of clearing the gird fast if it is getting to high.

colour removal bomb

The special bombs cause everything within a four block radius when clicked on.


Various Levels

There are ten levels within this game every time the user increase their level the number of lines is increased by using the formula lines = 20(2 * lines) also every level up to ten has an extra type of block added to it, including the super bomb and platform and indestructible blocks.

The level option in the menu bar opens a drop down allowing the user to choose what level within the ten levels available they wish to start the game at.

Saving & Loading

This will save the puzzle in whatever point in the game the player is at so that it can loaded again later to have another go or to finish it off and get to the next level. The file save opens up a File Chooser with options to decide the file name and also allow them to save the file to whatever folder directory the player chooses. The default setting will be to save the file in the 'My Documents' folder of a computer.


Loading a game can be done from a file with the extension .dat file, the file format has the grid first and the to read in things like the score, number of lines and level at the end. The choosing of the file selected by using a File Chooser enabling the user to quickly import the file with familiar and popular option.



Need a little assistance in the game to remind you how to play there is also a useful help section.