I'm an elder learning Java, and am somewhat a bit confused when it comes to algorithms and such like.

I have had to create an application that when a user inputs a number of crazy frogs hit with a hammer, your points score is given back to you.

If 2 frogs are hit, you are given 2 points (1 point per hit)
3 frogs, 6 points (2 points per hit)
4 frogs, 12 points (3 points per hit)
5 frogs, 20 points (4 points per hit) etc etc

OK, so I have created my a class for the LookupScore

package crazyfrogs; 
    public class LookupScore extends WhackScore {
    public void Initialise(){
    public int getScore(int hits){
           return 100;   /just a value to return something at the moment      

My Main code looks like this

package crazyfrogs;

import javax.swing.*;

public class Main {
    public static void main(String[] args) {
        String input;

        //create score class
        WhackScore whacks = new LookupScore();

        whacks.Initialise(); //initialises score generator

        //include a loop to capture whacks score
        boolean flag = true;

            int hits = 0;

            //TO DO ask for input
            input = JOptionPane.showInputDialog("WELCOME TO THE CRAZY FROG GAME\n\n" +
                    "Please enter the number of crazy frogs hit\n\n(scores under 0 will exit the program)");

            hits = Integer.parseInt(input);
            //provide quit method
            if (hits < 0)
                flag = false;
                JOptionPane.showMessageDialog(null, "YOUR FROG HAS DIED FROM HEAD INJURIES\n\n" +
                        "croak! cro...",
                        "The End", JOptionPane.INFORMATION_MESSAGE);
                //get look-up score from score class
                int score = whacks.getScore(hits);

                //display score
                JOptionPane.showMessageDialog(null, "Your Lookup score is: " +score);
        }while (flag == true);

and my WhackScore class is

package crazyfrogs;

public class WhackScore {
    public void Initialise(){
    public int getScore(int whacks){
           return 100; //just a value to return something

OK, my problem is, I can create the above, but when it comes to getting my old head around creating this lookup table, my brain goes into melt down. What I have been asked to implement is is when a number of hits has been registered, the application will look up the number from the lookup table to get the score.

The scores can be hard coded into the application if it is easier.

What I am after is some pointers to getting my head kick started or even a snippet of code to help me complete it.

Over to the experts!

Well, the progression you outlined doesn't need a lookup really, it's just n(n-1) , but I suppose you could use an array or a HashMap to look up the score if it says that you must do so. Given an array of {2,6,12,20} a simple subtraction will transform "hits" to the array index of the score. I'll leave it to you to figure what that subtraction would be.